LPology / Simple-Ajax-Uploader

Javascript file upload plugin with progress bar support. Works in all major browsers, including IE7+, Chrome, Firefox, Safari, and Opera. No dependencies - use it with or without jQuery.
995 stars 267 forks source link

v2.4 file uploads are zero length #137

Closed dleffler closed 8 years ago

dleffler commented 8 years ago

I've been using this product for several years, but after moving from v2.3 to v2.4 it seems to have broken something. This upload is handled within php as an XHR but the file_put_contents($_destFullPath, file_get_contents('php://input')); only creates a zero-length file with no errors reported. Reverting back to the v2.3 file restores functionality.

LPology commented 8 years ago

In your Javascript code, set this option for the uploader: multipart: false

The default for multipart was changed from false to true with version 2.4 (indicated in the changelog).

dleffler commented 8 years ago

I've tried that, but then it doesn't send back any parameters in $_REQUEST/$_GET (the 'data' parameter), nor is the name or filename sent

LPology commented 8 years ago

Try setting noParams: false along with multipart: false

dleffler commented 8 years ago

That seems to have done the trick, required explicitly setting both (back) to false. Thanks!

LPology commented 8 years ago

Glad to help.

And sorry for the annoyance. The reason for the change is that I think it will make it easier for people to use the plugin going forward by defaulting to the more broadly accepted method of uploading files (multipart form).

I'll update the Changelog with a little more detail. Let's also leave this issue open for a little while to make it easier to find in case anyone else comes across the same problem. Thanks for bringing it up.