我有一个基于laravel5的php web应用程序。我用的是nginx。在我的网站上有一个联系人表格,用户可以上传多个文件。我的问题是,每当用户上传多个文件时,它都不会上传,而是在很长一段时间内显示加载。如果上传单个文件,那么它会立即上传。我不知道为什么
OS: ubuntu 14.04 x64
nginx/1.8.0 , PHP 5.6.14-1
有什么建议吗?
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;
`
站点已启用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;
首先——对不起我英语不好,哦,环球语)
你不能提供更多信息。但我试着解释。
如果你想上传单个文件:
<input type="file" name="upload_file">
对于后端:
$_FILES['upload_file']['tmp_file']
如果你想上传多个文件:重要!这两个案例!
案例一(我想这是你目前的案例):
<input type="file" name="upload_file[]">
对于后端:
$_FILES['upload_file'][$arrKey]['tmp_file']
案例二:
<input type="file" name="upload_file" multiple="multiple">
对于后端:
$_FILES['upload_file']['tmp_file']
寻找第二种情况——相当于单个上传的后端代码。它是如何工作的?因为浏览器发送多个文件,请求是分开的,所以每个请求一个文件。您可以显示所有文件和/或当前上传文件的上传状态。