php - nginx 并行上传问题表单提交

标签 php nginx laravel-5 ubuntu-14.04 hhvm

我有一个基于 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']

寻找案例二——与单次上传等效的后端代码。 怎么运行的? 因为浏览器发送多个文件与分开的请求,每个请求一个文件。您可以显示所有文件和/或当前上传文件的上传状态。

关于php - nginx 并行上传问题表单提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34336149/

相关文章:

php - 使用 SEO 友好的链接

angular - 提供静态文件时,nginx docker 容器出现 Forbidden 403 错误

php - 为什么 attach 方法在 Laravel 中返​​回 null?

javascript - 看似有效的 JSON 上的 JSON.parse 错误

php - 一年前查询日期时间

php - 使用 JMS 序列化器仅将实体关系序列化为 Id

php - 从 MySql 中选择所有并加入其他

c++ - nginx/FastCGI 应用程序每次请求多次加载页面

iOS App Transport Security 不接受 TLSv1.2 连接和 plist 异常没有任何区别

mysql - 在 Laravel 中对分页变量进行排序