![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML5 File API readAsBinaryString reads files as much larger and different than files on disk
This may happen if you are reading your file as a binary string and forming the multipart/ form-data request manually.
You need to try and use xhr.send(File) and work around xhr progress event, which is fired when all list items had been already created.
Example
The following is our upload function −
function display(url, files) { var myForm = new FormData(); for (var j = 0, file; file = files[j]; ++j) { myForm.append(file.name, file); } var xhr = new XMLHttpRequest(); xhr.open('POST', url, true); xhr.onload = function(e) { ... }; xhr.send(formData); }
Advertisements