File upload problem

[email protected] ("Frans Bakker")
Newsgroups php.dev
Message-ID <[email protected]>
Hello everybody,

I am relatively new to PHP and for quite some days I am trying to get a file
upload system going through a standard html form. To test it I use an html
page called Test2.php with a form in it with
enctype=\"multipart/form-data\". Here is the source code:

<?php

$AppImageDir = Web/Images";

if (isset($_FILES["ImageFile"])) {
move_uploaded_file($_FILES['ImageFile']['tmp_name'],
$AppImageDir."/".$_FILES['ImageFile']['name']);

}

?>

<html>
<head>
<title>Web site - pages form</title>
</head>
<body>
<?php

echo "
<form action=\"Test2.php\" enctype=\"multipart/form-data\"
method=\"post\">
<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"80000\">
<input type=\"file\" name=\"ImageFile\">
<input type=\"submit\" name=\"btnSubmit\" value=\"Upload\">
</form>
";
?>

</body>
</html>

It is a standard straight forward image upload situation. You see that the
form directs to itself (action=\"Test2.php\") and on top of the page a
simple instruction to see if the file uploads correctly. As far as I can
see, this is correct code. Note that the any \\ are to escape "" and further
\\ (necesary in echo "" statements).

However, when I execute the page, I get the following error messages:

Warning: Unable to create '/Web/Images/cartel_feria1.jpg': Permission denied
in /Web/Test2.php on line 6

Warning: Unable to move '/tmp/php0jHeNE' to '/Web/Images/cartel_feria1.jpg'
in /Web/Test2.php on line 6

It seems to say that I don't have permission to execute a file upload on
that page. As you can see by the directory specifications this script runs
on a Linux. However, I also tried the same script on a Windows machine, with
the corresponding directory specifications of course, and with the same
result: permission denied.

What is wrong here, where do I set what type of permissions in order to get
the file upload to work? By the way, in the php.ini FileUpload is set at
yes.

Kind regards,
FRANS BAKKER
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.