Page 1 of 1

Upload of bigger files

Posted: Tue Sep 16, 2003 12:20 pm
by Telos
I have a file upload script which works fine with smaller files but when I try to upload some bigger files it fails. and I mean as a smaller files some less than one MB files and with big I mean about 10MB files. here's the code:

Code: Select all

if($submit)
{
$uploaddir = '../files/';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) 
{
  echo "<script>alert('the file upload completed succesfully');</script>";
  redirect('files_add.php?filename='.$_FILES['userfile']['name']);
} 
else 
{
  echo "<script>alert('the file upload did NOT succeeded');history.go(-1);</script>"; 
}


}
else
{
echo "
<br>
<form action="files_upload.php" method="post" enctype="multipart/form-data">
<table width="75%" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td>
	This is the first step of file adding process. In this step you will upload your file into our webhost.
	Do not add any material which has copyright or violates any
	laws. Do not also add large files (tens of MBs) without the agreement of clan leader.<br><br>
	</td>
  </tr>
  <tr>
    <td>
	<input type="file" name="userfile">
	<input type="hidden" name="MAX_FILE_SIZE" value="200000000">
	<input type="submit" value="upload the file" name="submit">
	</td>
  </tr>
</table>
</form>
";

}
can someone please tell me what's wrong with that if you know.

Posted: Tue Sep 16, 2003 12:34 pm
by micrix
hi,

i think your script run into a time out error or your vars does not allow such big files.
check the values of file_uploads, upload_max_filesize, upload_tmp_dir and post_max_size in the php.ini file.
furthermore set your script-timeout to zero. check ini_set() for more information.


greets micrix

Posted: Tue Sep 16, 2003 2:26 pm
by Telos
ok, I located the problem. It's the upload_max_filesize in php.ini file which is set to 8M. But I can't go around it. I tried to re-set it like this

Code: Select all

ini_set("upload_max_filesize","100M");
but it still doesn't work. I think I may have an error in my syntax there but I couldn't find an example anywhere so correct it if it's wrong and tell me how can I can bypass it.

Posted: Tue Sep 16, 2003 2:31 pm
by micrix
the syntax seems to be ok.
but what's about post_max_size?
you might set these values directly in the php.ini. please check the documentation.

that may help you:
http://groups.google.de/groups?hl=de&lr ... 26tab%3Dwg

greets micrix

Posted: Tue Sep 16, 2003 3:08 pm
by Telos
the value of post_max_size is 80M so it's not that. I don't have access to php.ini directly because I'm talking about a rental host.