Upload Progress Issue -- do not have "uploading" state

Brice Figureau brice+nginx at daysofwonder.com
Thu Apr 21 13:42:30 MSD 2011


On 21/04/11 03:30, Yanxin Z. wrote:
> Hello,
> I am trying to use Nginx + Upload Module + Upload Progress Module, which
> I follow the link
> http://wiki.nginx.org/NginxHttpUploadProgressModule#Usage
> 
> I find some issue in initial config, like X-Progress-ID should be added
> in upload_pass_form_field
> 
> Now I have the last problem is upload.state is not changing during file
> transfer. When upload starts, the state is "Starting", when upload is
> done, state becomes "done". But in the period, states never becomes
> "uploading". This cause the status bar is not working.
> 
> Could anyone help me to solve this issue?
> Thanks.
> 
> I post my config here:

I think your config is extremely complex, there are certainly ways to
make it simpler. Remember tha the upload progress module is trick, and
your config certainly breaks it.

Also, you didn't tell us how you were testing: remember that if you test
over localhost even with large (multi gigabyte) files, the upload will
take way less time than you can see. Make sure to either throttle your
upload (for instance do the upload with curl) so that you have a chance
to actually see it.

> //conf
> 
> 246        location ~ /api/1.0/web/upload.php {
> 247 #            limit_req   zone=box; #set request limit for box
> 248             root           html;
> 249             fastcgi_pass   127.0.0.1:9000;
> 250             fastcgi_param  SCRIPT_FILENAME
> /opt/nginx/html/script$fastcgi_script_name;
> 251             include        fastcgi_params;
> 252
> 253         }
> 
> 268         location ~ /api/1.0/web/upload_internal {
> 269             # Pass altered request body to this location
> 270
> 271             if ($request_method = POST) {
> 272                 upload_pass   @post_upload;
> 273                 break;

I think the problem is here. You tell nginx to break so the
track_uploads doesn't get a chance to run.


> 274             }
> 275
> 276             #proxy to upstream server
> 277             proxy_pass http://127.0.0.1;
> 278             proxy_redirect default;
> 279
> 280             # Store files to this directory
> 281             upload_store /opt/nginx/html/upload_file;
> 282
> 283             # Allow uploaded files to be read only by user
> 284
> 285             upload_store_access user:rw group:rw all:rw;
> 286             upload_set_form_field $upload_field_name.name
> "$upload_file_name";
> 287             upload_set_form_field $upload_field_name.content_type
> "$upload_content_type";
> 288             upload_set_form_field $upload_field_name.path
> "$upload_tmp_path";
> 289
> 290             # Inform backend about hash and size of a file
> 291             upload_aggregate_form_field "${upload_field_name}_md5"
> $upload_file_md5;
> 292             upload_aggregate_form_field "${upload_field_name}_size"
> $upload_file_size;
> 293
> 294             upload_pass_iform_field
> "^X-Progress-ID$|^submit$|^email$";
> 295
> 296
> 297             # track uploads in the 'proxied' zone
> 298             # remember connections for 30s after they finished
> 299             track_uploads proxied 30s;
> 300
> 301         }
> 
> 303         # Pass altered request body to a backend
> 304         location @post_upload {
> 305             rewrite /api/1.0/web/upload_internal
> /api/1.0/web/upload.php last;
> 306         }
> 307
> 308         location ^~ /progress {
> 309             report_uploads proxied;
> 310         }
> 
> 
> //form //



More information about the nginx mailing list