Posted by brian.digipimp on 11/30/05 09:40
So I wrote this upload script and I keep getting errors and can't get
it to work. I'm running ubuntu linux and here is my code:
<html>
<head>
<title>Upload</title>
</head>
<body>
<?php
if(isset ($_POST['submit'])) {
if (move_uploaded_file ($_FILES['file']['tmp_name'],
"../upload/{$_FILES['file']['name']}")) {
echo 'Your file has been uploaded';}
else {
echo 'Your file could not be uploaded because: ';
switch ($_FILES['file']['error']) {
case 1:
echo 'The file exceeds the upload_max_filesize setting in php.ini';
break;
case 2:
echo 'The files excees the MAX_FILE_SIZE setting in the HTML form';
break;
case 3:
echo 'The file was only partially uploaded';
break;
case 4:
echo 'No file was uploaded';
break;
}}}
?>
<form action="upload.php" enctype="multipart/form-data" method="post">
<input type="hidden" name="MAX_FILE_SIZE="50000">
<input type="file" name="file">
<input type="submit" name="submit" value="Upload">
</form>
</body>
</html>
I keep getting 2 errors:
Warning: move_uploaded_file(../upload/whatever.txt): failed to open
stream: No such file or directory in /var/www/upload.php on line 10
Warning: move_uploaded_file(): Unable to move '/tmp/phpUztFu8' to
'../upload/whatever.txt' in /var/www/upload.php on line 10
What does this mean and how do I fix it?
Navigation:
[Reply to this message]
|