Nginx parllel theme download

I have a php web application that is building on laravel5. I am using nginx. there is a contact form on my website in which a user can upload multiple files. My problem is when the user uploads several files, not downloading them, but showing the download for a very long time. if you download one file, then download it instantly. I'm not sure why

OS: ubuntu 14.04 x64 nginx/1.8.0 , PHP 5.6.14-1 

any suggestions?

nginx.conf:

  ` worker_rlimit_nofile 40000; http { ## # Basic Settings ## proxy_connect_timeout 600s; proxy_send_timeout 600s; proxy_read_timeout 600s; fastcgi_send_timeout 600s; fastcgi_read_timeout 600s; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; server_tokens off; client_max_body_size 512m; server_names_hash_bucket_size 64; # server_name_in_redirect off; ## # Gzip Settings ## gzip on; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; gzip_vary on; gzip_proxied any; ` 

site-enabled default.conf:

  fastcgi_connect_timeout 140; fastcgi_send_timeout 400; fastcgi_read_timeout 400; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; 
+5
source share
1 answer

For starters - sorry for my bad English, oh Globish))

You cannot give more information. But I'm trying to explain.

If you want to upload a single file:

 <input type="file" name="upload_file"> 

and for the backend:

 $_FILES['upload_file']['tmp_file'] 

If you want to upload multiple files: IMPORTANT! These are two cases!

Case one (I suppose this is your current case):

 <input type="file" name="upload_file[]"> 

and for the backend:

 $_FILES['upload_file'][$arrKey]['tmp_file'] 

Case two:

 <input type="file" name="upload_file" multiple="multiple"> 

and for the backend:

 $_FILES['upload_file']['tmp_file'] 

Take a look at case two, the backend code equivalent for a single download. How it works? Since the browser sends multiple files with separate requests, one file per request. And you can show the download status for all files and / or for the current download file.

0
source

Source: https://habr.com/ru/post/1238526/


All Articles