Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefox + nginx upload module #3

Open
a-chernykh opened this issue Oct 15, 2010 · 1 comment
Open

Firefox + nginx upload module #3

a-chernykh opened this issue Oct 15, 2010 · 1 comment

Comments

@a-chernykh
Copy link

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);
@drewbuschhorn
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants