quakerstate79
11-16-2006, 06:53 PM
Hey guys, I found the following code online, it works great for smaller files. However, when I try to use it for 32mb or so, it crashes with errors.
Here's the form:
<form enctype="multipart/form-data" action="./phpscripts/testfileupload.php"
method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1024000">
<br>
<input name="uploadfile" type="file">
<br>
<input name= "upload" type="submit" value="Upload File">
</form>
and here's the script:
ini_set('max_execution_time', 18000);
ini_set("memory_limit","202M");
ini_set("time_limit","5555");
ini_set("post_max_size","2001M");
ini_set("upload_max_filesize","2000M");
$target_path = "../uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
}
else
{
echo "There was an error uploading the file, please try again!";
}
When try to upload a large file (32mb) i get the following errors.
[16-Nov-2006 11:38:13] PHP Notice: Undefined index: uploadfile in ..../fileuploader/phpscripts/testfileupload.php on line 28
[16-Nov-2006 11:38:13] PHP Notice: Undefined index: uploadfile in ../fileuploader/phpscripts/testfileupload.php on line 30
How i interpret this, is that for a large file, something in the connection is immediately stopped therefore the _FILE array never gets populated. Anyone run into this before? Know any workarounds? Eventually I'm going to need a script that handles much bigger uploads. Thanks so much in advance for your expertise.
Cheers,
Q
Here's the form:
<form enctype="multipart/form-data" action="./phpscripts/testfileupload.php"
method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1024000">
<br>
<input name="uploadfile" type="file">
<br>
<input name= "upload" type="submit" value="Upload File">
</form>
and here's the script:
ini_set('max_execution_time', 18000);
ini_set("memory_limit","202M");
ini_set("time_limit","5555");
ini_set("post_max_size","2001M");
ini_set("upload_max_filesize","2000M");
$target_path = "../uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
}
else
{
echo "There was an error uploading the file, please try again!";
}
When try to upload a large file (32mb) i get the following errors.
[16-Nov-2006 11:38:13] PHP Notice: Undefined index: uploadfile in ..../fileuploader/phpscripts/testfileupload.php on line 28
[16-Nov-2006 11:38:13] PHP Notice: Undefined index: uploadfile in ../fileuploader/phpscripts/testfileupload.php on line 30
How i interpret this, is that for a large file, something in the connection is immediately stopped therefore the _FILE array never gets populated. Anyone run into this before? Know any workarounds? Eventually I'm going to need a script that handles much bigger uploads. Thanks so much in advance for your expertise.
Cheers,
Q