jquery-upload-progress icon indicating copy to clipboard operation
jquery-upload-progress copied to clipboard

Firefox + nginx upload module

Open a-chernykh opened this issue 15 years ago • 1 comments

It does not triggering the success event in the Firfox because of the JSON data type. The nginx returns:

new Object({ 'state' : 'uploading', 'received' : 72437, 'size' : 56476961 })

My workaround is to change hardcoded datatype:

options = $.extend({ dataType: "text",

And evalute the response in success handler:

success: function(upload) {
  upload = eval(upload);

a-chernykh avatar Oct 15 '10 07:10 a-chernykh

Hey Andrey,

I ran into this as well. It looks like, for reasons unknown to god or man ... I guess lighttpd backwards compat ... the default behavior for the nginx upload module is to serve the data as 'Java Fomat'. Check this out:

https://github.com/masterzen/nginx-upload-progress-module/blob/master/ngx_http_uploadprogress_module.c#L235 https://github.com/masterzen/nginx-upload-progress-module/blob/master/ngx_http_uploadprogress_module.c#L242 https://github.com/masterzen/nginx-upload-progress-module/blob/master/ngx_http_uploadprogress_module.c#L249

To avoid that, set the JSON or JSONP parameter like so: upload_progress_jsonp_output; upload_progress_json_output; in your 'location' block.

https://github.com/masterzen/nginx-upload-progress-module/blob/master/ngx_http_uploadprogress_module.c#L141

And that should fix you up.

Drew


PS. I guess I should file a pull request with the nginx-upload-mod people to make the behavior clearer in the doc. Do you have a vote if the default behavior should be JSON or JSONP? I can't decide.

drewbuschhorn avatar Nov 10 '11 18:11 drewbuschhorn