petersirka / node-filestorage

Storage for storing uploaded files in node.js
MIT License
72 stars 12 forks source link

Content-length not always correct when sent via form-data/multipart #10

Closed davidworkman9 closed 9 years ago

davidworkman9 commented 9 years ago

Demo here: https://github.com/davidworkman9/contentLengthBugFilestorage

The demo when ran uploads two text files, one 196609 bytes, another 84 bytes. Stats report that the 84 byte file has a length of zero, the other file reports correctly. If I remove one character from the end of the large file, bringing the bytes down to 196608 the content-length is reported as 131072 (a difference of 65536, don't know if that has any significance).

This doesn't happen when using a fs.createReadStream, but comes up when a file is sent in a POST request, as shown in the example.

petersirka commented 9 years ago

Hi @davidworkman9, I'll test it tomorrow. I'll give you a feedback. Thanks.

petersirka commented 9 years ago

Hi @davidworkman9, I fixed it and I published a new version 1.2.0 on NPM (please reinstall). There was a critical bug. Thanks for report.

davidworkman9 commented 9 years ago

Thanks so much! Best day ever, not only is the file size coming through now but a problem I ran into last night with trying to upload 5 documents at once is now solved!