1 (edited by 5050 2017-08-26 22:33:51)

Topic: Server fails to decode multipart header

Hi,

The same plupload code that works nice on a server hosted by O2Swich fails when it is hosted on free.fr (Proxad service) server. More, even the plupload demo fails to upload on this hosting.

I spend hours to try to understand what was happening and I finally found that on free.fr servers the mutipart/form-data header is not decoded by apache and is included in the file, resulting in 2 things :

1) All parameters are lost ($_POST variable is empty) and upload.php is not able to retrieve the file name name or chunk number, leaving files with random name got from $fileName = uniqid("file_");

2) The multipart headers are included in the file generated for first chunk sent, exactly as reported in this discussion : http://www.plupload.com/punbb/viewtopic.php?id=15266

Stupidly, I spent hours and hours trying to understand what was happening, before discovering that this occurs when chunk size is close enough to post_max_size returned by the server.
On free.fr hosting, phpinfos() tells that post_max_size = 2MB, so I set plupload chunksize : '2mb' too ... and it failed. But it works after reducing  chunk_size: '1.95 mb'. :-(


I think it would be better that plupload checks itself the max upload size (by a query to upload.php) and then ensure chunk size + multipart headers NEVER overrun the max size !

Hope it may help...

Re: Server fails to decode multipart header

Ouch. Thanks for reporting that.

I don't think we could check for `post_max_size` reliably enough, basically since there might be a backend in a language other than PHP. But I see how one could precheck that condition prior to starting upload with additional ajax request for example.

If you want to see your issue fixed, do not report it here, do it on - GitHub.

Re: Server fails to decode multipart header

Do you think I would be better to report it as issue on github ?

I'm shared : it is not really a bug, but it can be a real nag trick to go crazy ! (even if I was already ! :-p)