Jump to content

[SOLVED] Problem Uploading Larger Files


advancedfuture

Recommended Posts

First off I don't know if this should be under the apache forum, or here... as I don't know if the issue is my code, or my apache server.

 

I have editted my php.ini file to allow the following:

 

max_execution_time = 300

max_input_time = 300

memory_limit = 300M

 

I also set my upload script to never timeout as shown in my sourcecode below... Yet for some reason it doesn't always except the file... and many times if the file is over 7mb it tries for a minute then executes the else statement and gives me the "Error" message..

 

Am I going about this the right way?

 

<?php

echo '<form action="videoUpload.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<input name="ufile" type="file" id="ufile" size="50" />
<input type="submit" name="submit" value="Upload" />
</form>';

if($_POST['submit'])
{
set_time_limit(0);
$sourcefile = $_FILES['ufile']['tmp_name'];
$destfile = md5(uniqid(rand(), true));
$path = "upload/".$destfile;

copy($sourcefile, $path);
//$newname = md5(uniqid(rand(), true)).".flv";
//$exec = "ffmpeg -i upload\\".$destfile." -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 upload\\".$newname;
//exec($exec);
}

else
{
echo "Error Uploading Video File";
}

//unlink($path);
?>

Link to comment
https://forums.phpfreaks.com/topic/86702-solved-problem-uploading-larger-files/
Share on other sites

There are two other size limits, upload_max_filesize and post_max_size, mentioned in the php manual - http://www.php.net/manual/en/features.file-upload.common-pitfalls.php that also affects the size of a file that can be uploaded.

There are two other size limits, upload_max_filesize and post_max_size, mentioned in the php manual - http://www.php.net/manual/en/features.file-upload.common-pitfalls.php that also affects the size of a file that can be uploaded.

 

BINGO!

 

I had set upload_max_filesize = 300M

 

but I didn't know about post_max_size.... thats where I was failing... since this is a POST form.

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.