Hi I'm trying to write a php script that will upload files to the server.
I do have ISPConfig installed but I think that I've changed things in the necessary areas to not have problems with ISPConfig.
Here is the script:
Code:
<head>
<meta http-equiv="content-type" content="text/html"; charset="iso-8859-1" />
<title>Uploading Files...</title>
</head>
<body>
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_POST['submit']))
{
echo "<pre>";
print_r($_FILES);
echo "</pre>";
if(move_uploaded_file($_FILES['thefile']['tmp_name'], "Proposal/{$_FILES['thefile']['name']}"))
{
print '<p>Your file has been uploaded successfully!</p>';
}
else
{
print '<p>Your file could not be uploaded because: <b><br>';
print 'Temp Name: ';
print "{$_FILES['thefile']['tmp_name']}";
print '<br>';
print 'Name: ';
print "{$_FILES['thefile']['name']}";
print '<br>';
switch($_FILES['thefile']['error'])
{
case 1:
print 'The file exceeds the upload_max_filesize setting in php.ini';
break;
case 2:
print 'The file exceeds the MAX_FILE_SIZE setting in the HTML form';
break;
case 3:
print 'The file was only partially uploaded';
break;
case 4:
print 'No file was uploaded';
break;
case 6:
print 'No temp directory found';
break;
case 7:
print 'Cannot write file to specified location';
break;
case 8:
print 'Extension not valid';
break;
}
print '</b></p>';
}
}
?>
<form name = "uploader" method = "post" action = "Upload.php" enctype = "multipart/form-data">
<p>Upload a file using this form: <br/><br/>
<input type = "hidden" name = "MAX_FILE_SIZE" value = "3000" />
<input type = "file" name = "thefile" /><br/><br/>
<input type = "submit" name = "submit" value = "Upload File" />
</p>
</form>
</body>
</html>
When I run this I have the error 6 come up. The error that says there is no temporary directory. Also the $_FILES['thefile']['tmp_name'] value is empty.
I don't know what I'm doing wrong. The temporary directory has permissions 777 and I've set the temporary directory. I've looked through php.ini and can't see any problems. Anyone have any suggestions? Thanks!
Recent comments
2 days 20 hours ago
3 days 5 hours ago
3 days 8 hours ago
3 days 9 hours ago
3 days 11 hours ago
3 days 12 hours ago
3 days 14 hours ago
3 days 15 hours ago
4 days 7 hours ago
4 days 8 hours ago