PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi,
Im trying to upload a document file in to a remote server. But im getting the following error. I tried changing the permission for the folder also.
It works fine when i tried in the local machine. What may be the problem
Warning: move_uploaded_file(/home/smartchu/public_html/website_content/test1_595446942/test.doc): failed to open stream: Permission denied in /home/smartchu/public_html/upload_test.php on line 26
Warning: move_uploaded_file(): Unable to move '/tmp/php23ki2U' to '/home/smartchu/public_html/website_content/test1_595446942/test.doc' in /home/smartchu/public_html/upload_test.php on line 26
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
/tmp/php7AbDG5/tmp -drwx
/tmp/php7AbDG5 f-rw-
/home/smartchu/public_html/website_content/Taj_tender_request.doc/home -----
/home/smartchu -dr-x
/home/smartchu/public_html -drwx
/home/smartchu/public_html/website_content -dr--
/home/smartchu/public_html/website_content/Taj_tender_request.doc
Warning: is_file(): Stat failed for /home/smartchu/public_html/website_content/Taj_tender_request.doc (errno=13 - Permission denied) in /home/smartchu/public_html/dev_test.php on line 10
-
Warning: is_dir(): Stat failed for /home/smartchu/public_html/website_content/Taj_tender_request.doc (errno=13 - Permission denied) in /home/smartchu/public_html/dev_test.php on line 11
----
Your script is not allowed to change to or write to the directory /home/smartchu/public_html/website_content thus it cannot create /home/smartchu/public_html/website_content/Taj_tender_request.doc
who am i:
whoami: nobody
groups: nobody
ls -lad /home/smartchu/public_html/website_content/: drwxr--r-- 2 smartchu smartchu 4096 Feb 27 04:01 /home/smartchu/public_html/website_content/
drwxr--r-- 2 smartchusmartchu 4096 Feb 27 04:01 /home/smartchu/public_html/website_content/
the d at the beginning means it's a directory. The next three, green characters mean the owner has read,write,execute permissons. The blue section shows the permissions for the group: read-only. And the red section shows the permissions granted to everybody else (not the owner and not in "owning" group)
The next green text is the name of the owner: smartchu. And there's also a group called smartchu and it's the group associated with this directory.
You script runs as nobody which is only member of the group nobody. So neither the owner nor the group permissions apply when accessing the directory /home/smartchu/public_html/website_content/
see also: http://www.google.de/search?hl=en&q=uni ... tnG=Search