通过AJAX上传大文件(45MB)失败 [英] Uploading large file (45MB) via AJAX failing

查看:127
本文介绍了通过AJAX上传大文件(45MB)失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过AJAX上传文件.大约10MB的小文件已成功上传.

I'm trying to upload files via AJAX. Small files ~10MB are being uploaded successfully.

但是,当我尝试上传较大的文件时,它失败并显示以下消息:

However, when I try to upload larger files, it fails with the following message:

内部服务器错误

服务器遇到内部错误或配置错误,并且无法完成您的请求.

The server encountered an internal error or misconfiguration and was unable to complete your request.

请联系服务器管理员webmaster @ .com并通知错误发生的时间,以及您可能做的所有事情可能是导致错误的原因.

Please contact the server administrator, webmaster@.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

有关此错误的更多信息可能在服务器错误中可用日志.

More information about this error may be available in the server error log.

此外,在执行以下操作时遇到了500 Internal Server Error错误尝试使用ErrorDocument处理请求.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

我在Dreamhost上使用 Laravel 5 .

I'm using Laravel 5 on dreamhost.

我已经在所有地方放置了调试消息,但是似乎根本没有执行我的PHP代码.另外,error.log中也没有任何信息.

I've put debugging messages everywhere, but it seems that my PHP code is not being executed at all. Also, there's no info in error.log either.

我已经使用以下设置检查了 php.ini :

I've checked php.ini with following settings:

max_execution_time 30
max_file_uploads 20
post_max_size 500M
upload_max_filesize 500M

最初,我将/tmp文件夹挂载在一个分区大小为100MB的地方.当时,error.log表示"modsecurity:输入筛选器无法将8192字节写入临时文件" 因此,我将/tmp 文件夹的位置更改为我的主文件夹,以消除大小限制,但不起作用.

Intially, I had mounted /tmp folder at one place which had partition size of 100MB. At that time, the error.log said "modsecurity: input filter failed writing 8192 bytes to temporary file" So I changed to location of /tmp folder to my home folder in order to remove size restrictions, but not working.

这是当前的行为:文件上传显示100%.然后,该请求将等待一段时间而不引起日志.片刻后,将返回上述错误消息.

Here is the current behaviour: File upload shows 100%. Then the request waits for sometime without causing logs. After a while, the above mentioned error message is returned.

让我知道还需要哪些信息.

Let me know which further info is required.

非常感谢!

推荐答案

对于此类问题,您应该使用php.ini的几​​个参数.

For such issues, You should play with few parameters of php.ini.

  1. max_execution_time
  2. max_input_time
  3. post_max_size
  4. upload_max_filesize

尝试将max_execution_time和max_input_time保持为零(0).

Try to keep max_execution_time and max_input_time to ZERO (0).

这不会将您的执行时间限制在30秒内.

It won't bound your execution to 30 seconds.

希望这会有所帮助!

这篇关于通过AJAX上传大文件(45MB)失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆