Empty POST with nginx upload module and loaded upload

I am using the nginx upload module to accept large uploads for a PHP application. I configured nginx following this blog post (modified for my needs).

Here is the (applicable part) of my nginx config:

server {

    # [ ... ]

    location /upload {
        set $upload_field_name "file";
        upload_pass /index.php;
        upload_store /home/example/websites/example.com/storage/uploads 1;
        upload_resumable on;
        upload_max_file_size 0;
        upload_set_form_field $upload_field_name[filename] "$upload_file_name";
        upload_set_form_field $upload_field_name[path] "$upload_tmp_path";
        upload_set_form_field $upload_field_name[content_type] "$upload_content_type";
        upload_aggregate_form_field $upload_field_name[size] "$upload_file_size";
        upload_pass_args on;
        upload_cleanup 400-599;
        client_max_body_size 200M;
    }
}

      

In client side JavaScript I use 8MB chunks.

With this configuration, I can load any file that is one chunk or less. However, when I try to download any file that contains more than one chunk, the response I get from the server for each intermediate chunk is empty, and the last chunk triggers a call to the PHP application without any POST

input.

What am I missing?

+3


source to share


1 answer


It turns out that @Brandan 's blog post actually leaves one important directive aside:

upload_state_store /tmp;

      



I added that everything now works as expected.

+1


source







All Articles