Posted by ctiggerf on 04/09/07 13:41
I am having some troubles with file uploads on my server and was
hoping you guys could help out.
PHP is returning with the error UPLOAD_ERR_INI_SIZE for all files over
approx. 4Kb. I have set the upload_max_filesize to 1Gb, and ini_get()
reports that correctly.
You can run my little sample script here: http://www.paramountlists.com/v3/ftp/cff_test2.php
And now for the script:
<?php error_reporting (E_ALL); ?>
<html>
<head>
<title>Upload</title>
</head>
<body>
<?
if (!empty($_POST['upload'])) {
echo "<pre>";
print_r($_FILES);
echo "</pre><br>";
switch ($_FILES['myfile']['error']) {
case UPLOAD_ERR_OK:
echo "Upload was ok";
break;
case UPLOAD_ERR_INI_SIZE:
echo "Exceeds upload_max_filesize:
".ini_get("upload_max_filesize");
break;
case UPLOAD_ERR_FORM_SIZE:
echo "exceeds the MAX_FILE_SIZE.";
break;
case UPLOAD_ERR_PARTIAL:
echo "The uploaded file was only partially uploaded.";
break;
case UPLOAD_ERR_NO_FILE:
echo "No file was uploaded.";
break;
case UPLOAD_ERR_NO_TMP_DIR:
echo "Missing a temporary folder.";
break;
case UPLOAD_ERR_CANT_WRITE:
echo "Failed to write file to disk";
break;
default:
echo "Unknown File Error";
}
echo "<br>";
}
?>
<form method="post" enctype="multipart/form-data"
action="<?php echo $_SERVER['PHP_SELF'];?>">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000">
Upload File: <input name="myfile" type="file"><br>
<input name="upload" type="submit" value="Submit"></form>
</body>
</html>
If you guys think this would be better asked at the apache newsgroup
or something, let me know. I thought perhaps someone had run into the
same trouble.
Thanks,
Chris F.
Navigation:
[Reply to this message]
|