php-general | 2003022

Re: [PHP] File upload problem - permission denied From: 1LT John W. Holmes (holmes072000 <email protected>)
Date: 02/27/03

Make sure whatever user the _web server_ is running as has access to write
to that directory.

With IIS, this is the IUSR_<computer_name> account.

> $AppImageDir = Web/Images";

You've got a error in that line, also, hopefully it's just a typo, though.

---John Holmes...

----- Original Message -----
From: "Niklas Lampén" <niklas.lists <email protected>>
To: "Php-General" <php-general <email protected>>
Sent: Thursday, February 27, 2003 9:07 AM
Subject: RE: [PHP] File upload problem - permission denied

On linux you can do it in shell with chmod command. Do 'chmod 766 direcory'.
You can find out more about chmod-command at
http://www.die.net/doc/linux/man/man1/chmod.1.html.

Niklas

-----Original Message-----
From: Frans Bakker [mailto:jfbakker <email protected>]
Sent: 27. helmikuuta 2003 16:03
To: php-general <email protected>
Subject: Re: [PHP] File upload problem - permission denied

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 <email protected>> escribió en el mensaje
news:021a01c2de66$e657cf20$ba93c5c3 <email protected>
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 <email protected>]
Sent: 27. helmikuuta 2003 15:43
To: php-general <email protected>
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/

-- 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/

########################################### This message has been scanned by F-Secure Anti-Virus for Internet Mail. For more information, connect to http://www.F-Secure.com/

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php