move_uploaded_file (newbie error)

From: Raj (raj_at_nospam.com)
Date: 06/05/04


Date: Sat, 05 Jun 2004 00:34:06 +0100

Hi, I get the following errors when I try to use the file below. Any
ideas.

Raj
Newbie

ERRORS:

Warning: move_uploaded_file(../uploads/ok.jpg): failed to open stream:
No such file or directory in /www/webdir/test/upload_file.php on line
11

Warning: move_uploaded_file(): Unable to move '/tmp/phpVnaunp' to
'../uploads/ok.jpg' in /www/webdir/test/upload_file.php on line 11

THE FILE "upload_file.php":

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<?php
ini_set ('display_errors',1);
error_reporting (E_ALL & ~E_NOTICE);
if (isset ($_POST['submit'])){
        if (move_uploaded_file ($_FILES['thefile']['tmp_name'],
"../uploads/{$_FILES['thefile']['name']}")){
                print '<p>Your file has been uploaded.</p>';
        } else{
                print '<p>Your file could not be uploaded<b>';
        }
}
?>
<form action="upload_file.php" enctype="multipart/form-data"
method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<input type="file" name="thefile" /><br/><br />
<input type="submit" name="submit" value="Upload this file" />
</form>
</body>
</html>



Relevant Pages