.oO(Brett)
>In my test server environment (on my MAC), I have created
an upload_test
>folder in my Sites folder, one in my website root folder,
and one in my
>Home folder, but every time I attempt to upload an image
to any, I get
>an error like the one below:
>
>Warning:
>move_uploaded_file(/Users/brett/upload_test/Toyota_Corolla_91.jpg)
>[function.move-uploaded-file]: failed to open stream:
Permission denied
>in /Users/brett/vhosts/test10/upload04.php on line 6
>
>Warning: move_uploaded_file()
[function.move-uploaded-file]: Unable to
>move '/private/var/tmp/phpYorkEc' to
>'/Users/brett/upload_test/Toyota_Corolla_91.jpg' in
>/Users/brett/vhosts/test10/upload04.php on line 6
>
>I'm on a MAC running PHP 5.2.4, MySQL 5.0.24, I'm using
Apache 1.3.41
>which was pre-installed on my G5. The PHP/MySQL is a
build from Marc
>Liyanage which I installed from instructions in PHP for
DW8. Everything
>up until now has worked fine, but then I've never tried
to upload using
>PHP until now. This issue seems to be a Permission
problem and, try as I
>have, I cannot seem to get the correct permission to
upload. In looking
>at the Apache section in phpinfo() I see this:
>
>Hostname:Port localhost:80
>User/Group www(70)/70
>
>and it makes me wonder if I don't have permission because
I'm not logged
>in as user www?
Correct. Apache (and many other services and daemons as well)
uses its
own user account, usually 'www', 'www-data', 'nouser' or
something like
that.
>I log in as brett and I am the administrator so why is
>Apache setting www as the User.
That's the default behaviour.
>If that is the problem, how do I get
>Apache to have me as the user?
You could change it in the Apache config, but I wouldn't
recommend it.
Instead you should make the upload directory writable for the
server,
for example by changing its owner and group to the one Apache
uses. You
could also try to chmod that directory to 0777, but _only_ on
your own
local machine, never on a host, as you don't want such a
diretory being
writable for everyone.
As a hint: On my own sites I usually have a directory 'var'
with full
write access for the web server. In this directory I store
session data,
temporary files, my own log and all that stuff. All other
directories
are usually not writable for the server.
Micha