Trying to upload video file in php, but it's too large
Asked Answered
C

2

1

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. 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

and memory_limit is at 128 MB. I restarted WAMP and tried to upload the file, but it still did not upload. I then cleared my cache and history and restarted wamp, and it still didn't work. 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.

The video I am trying to upload is about 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:

[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

Also a php script with the following line:

echo ini_get('upload_max_filesize'), ", " , ini_get('post_max_size'), ", ", ini_get('memory_limit'): prints out: 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

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:

http://pastebin.com/RUVE093u

Colis answered 4/5, 2012 at 17:51 Comment(0)
P
9

Try these settings in 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.

Psychosis answered 4/5, 2012 at 17:54 Comment(5)
Just tried that. It didn't work, and echo ini_get('upload_max_filesize'), ", " , ini_get('post_max_size'), ", ", ini_get('memory_limit'): still prints out: 100M, 8M, 128M, and yes I did restart WAMP.Colis
@user1296259: which ini did u change ? C:\wamp\bin\apache\apache2.2.x\bin\php.ini or C:\wamp\bin\php\php5.3.10\php.ini ?Psychosis
I changed C:\wamp\bin\php\php5.3.10\php.iniColis
@user1296259: try it with the other one. I think it should workPsychosis
Yes! That worked! I wasn't even aware of the php.ini file under the Apache directory - only of the one under the php directory. Thankyou so much!Colis
E
1
8,388,608 bytes = 8 megabytes

Search php.ini for multiple occurances of 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.

Erk answered 4/5, 2012 at 18:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.