简体   繁体   English

尝试在php中上传视频文件,但太大

[英]Trying to upload video file in php, but it's too large

I'm trying to use a html file input tag to upload videos to a php 5.3.10 script running on a wamp 2.2 server. 我正在尝试使用html文件输入标签将视频上传到在wamp 2.2服务器上运行的php 5.3.10脚本。 I found that it won't upload and apparently it is too big. 我发现它不会上传,而且显然太大。

I have gone into php.ini and changed the following to 100M: post_max_size, upload_max_filesize 我进入php.ini,并将以下内容更改为100M:post_max_size,upload_max_filesize

and memory_limit is at 128 MB. memory_limit为128 MB。 I restarted WAMP and tried to upload the file, but it still did not upload. 我重新启动了WAMP,并尝试上传文件,但仍然没有上传。 I then cleared my cache and history and restarted wamp, and it still didn't work. 然后,我清除了缓存和历史记录,然后重新启动了Wamp,但仍然无法正常工作。 I then cleared the cache, turned off wamp, turned off my computer and then started up again, started wamp, and it still didn't work. 然后,我清除了缓存,关闭了wamp,关闭了计算机,然后再次启动,开始了wamp,但仍然无法正常工作。

The video I am trying to upload is about 25 MB. 我要上传的视频约为25 MB。

Inspite of the changes I made in php.ini, the Apache Error Log keeps posting this error, everytime I try to upload this video: 尽管我在php.ini中进行了更改,但每次我尝试上传此视频时,Apache错误日志都会不断发布此错误:

[error] [client 127.0.0.1] PHP Warning: POST Content-Length of 26246222 bytes exceeds the limit of 8388608 bytes in Unknown on line 0, referer: http://localhost/uploadFile.html [错误] [客户端127.0.0.1] PHP警告:POST Content-Length的26246222字节超出了第0行,Unknown中的8388608字节的限制,引用地址: http://localhost/uploadFile.html

Also a php script with the following line: 也是带有以下行的php脚本:

echo ini_get('upload_max_filesize'), ", " , ini_get('post_max_size'), ", ", ini_get('memory_limit'): prints out: 100M, 8M, 128M echo ini_get('upload_max_filesize'),“,”,ini_get('post_max_size'),“,”,ini_get('memory_limit'):打印输出:100M,8M,128M

So it seems that it is the post_max_size that is the problem, eventhough I set to 100M in php.ini 所以即使我在php.ini中将其设置为100M,似乎也是问题所在的post_max_size

What could be the problem? 可能是什么问题呢? How do I solve this?... 我该如何解决?

Here is a link to the contents of my php.ini file, which is under C:\\wamp\\bin\\php\\php5.3.10: 这是指向我的php.ini文件内容的链接,该文件位于C:\\ wamp \\ bin \\ php \\ php5.3.10下:

http://pastebin.com/RUVE093u http://pastebin.com/RUVE093u

Try these settings in C:\\wamp\\bin\\apache\\apache2.2.x\\bin\\php.ini 在C:\\ wamp \\ bin \\ apache \\ apache2.2.x \\ bin \\ php.ini中尝试这些设置

Find:
post_max_size = 8M
upload_max_filesize = 2M
max_execution_time = 30
max_input_time = 60
memory_limit = 8M

Change to:
post_max_size = 750M
upload_max_filesize = 750M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M

Then restart wamp. 然后重启wamp。

8,388,608 bytes = 8 megabytes

Search php.ini for multiple occurances of post_max_size. 在php.ini中搜索post_max_size的多次出现。 The last one is the one that's going to take effect. 最后一个将要生效。

Then check your website's/script-folder's .htaccess files, as they can override php.ini settings with their own values. 然后检查您网站的/ script-folder的.htaccess文件,因为它们可以使用自己的值覆盖php.ini设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM