fdintino/nginx-upload-module

POST form data are lost when using chunk mode of blueimp-jQuery-File-Upload

davidchern opened this issue · 1 comments

The Nginx server is compiled with the latest version of nginx-upload-module, no other modules compiled with.

When configuration is set as below:

    location /uploads {
          upload_max_file_size     50m;
          send_timeout             120s;
          client_body_timeout      360s;
          upload_buffer_size       256k;

          proxy_max_temp_file_size 0;
          proxy_buffering          off;

          add_header            Pragma no-cache;
          add_header            X-Content-Type-Options nosniff;
          add_header            Access-Control-Allow-Credentials "true";
          add_header            Access-Control-Max-Age 1200;
          upload_resumable      on;
          upload_pass_args      on;
          upload_state_store    /var/www/files/state;
          upload_store          /var/www/files/upload;
          upload_store_access   user:rw group:rw all:rw;

          upload_set_form_field $upload_field_name.name "$upload_file_name";
          upload_set_form_field $upload_field_name.content_type "$upload_content_type";
          upload_set_form_field $upload_field_name.path "$upload_tmp_path";
          upload_aggregate_form_field "$upload_field_name.sha256" "$upload_file_sha256";
          upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";
          upload_pass_form_field "^type$";
          upload_pass_form_field "^^file_id$";
          upload_cleanup         400 404 499 500-505;
          upload_pass           /upload/backend/;
    }

as well as typical configuration of blueimp-jQuery-File-Upload with chunk upload model, weird thing happens:

All data in form fields are missing, except for values from upload_set_form_field. To be detailed, upload_aggregate_form_field and upload_pass_form_field are all lost when the POST request is passed to the backend (written with Django 2.2).

One record from Django log file is like this:

2020-02-25 13:33:31,762 INFO: POST: <QueryDict: {'.name': ['abc_test.pdf'], '.content_type': ['application/pdf'], '.path': ['/var/www/files/upload/9cb5e5d5e4b4c2ed806b06758da4006f'], '.sha256': [''], '.size': ['570652']}>

I have tried many options of both nginx-upload-module and blueimp-jquery-upload, but failed at all.

Could any guy help me with it? Thank you in advance!

Well, even if I can pass the form data via another AJAX post or via http headers data, the hash value (like $upload_file_sha256) from upload_aggregate_form_field is lost. This should be a bug.