Re: File upload problem - permission denied
| From: | Frans Bakker | Date: | Thu, 27 Feb 2003 14:02:37 +0000 |
| Subject: | Re: File upload problem - permission denied | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137387@lists.php.net to get a copy of this message | ||
All right then. ¿Where do I set that permission for PHP? On my local Windows
machine it is usually in IIS. However the whole ..\inetpub\wwwroot\..
directory already has read and write permissions. Apart from PHP I use Cold
Fusion. With Cold Fusion I don't have any permission problems...
"Niklas lampén" <niklas.lists@publico.fi> escribió en el mensaje
news:021a01c2de66$e657cf20$ba93c5c3@Niklas...
Seems that php does not have write access to that directory. Set it right
and it should work.
Niklas
P.S. Tip: It's much quicker to create plain html without echo. Just do it
like
<form name="blah">, not like
<? echo "<form name=\"blah\">"; ?> :)
-----Original Message-----
From: Frans Bakker [mailto:jfbakker@hermes-b2b.com]
Sent: 27. helmikuuta 2003 15:43
To: php-general@lists.php.net
Subject: [PHP] File upload problem - permission denied
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
###########################################
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/