upload file error pls help gettin warning permission denied

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!

Moderator: General Moderators

Post Reply
Sourabh
Forum Newbie
Posts: 7
Joined: Sat Sep 13, 2008 2:18 am

upload file error pls help gettin warning permission denied

Post by Sourabh »

Hi everybody

I am new to PHP. Actually I am trying to upload a file on my local machine on the server through PHP
my code works fine in my local enviornment
but when I upload my work on the server(linux) it gives me following errors

Warning (2): move_uploaded_file(.\_files\collection_images\130908102208.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied [APP/controllers/collections_controller.php, line 274]

move_uploaded_file - [internal], line ??
CollectionsController::admin_save() - APP/controllers/collections_controller.php, line 274
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 268
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 240
[main] - APP/webroot/index.php, line 83

Warning (2): move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php2si8lz' to '.\_files\collection_images\130908102208.jpg' [APP/controllers/collections_controller.php, line 274]

move_uploaded_file - [internal], line ??
CollectionsController::admin_save() - APP/controllers/collections_controller.php, line 274
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 268
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 240
[main] - APP/webroot/index.php, line 83

Warning (2): chmod() [function.chmod]: No such file or directory [APP/controllers/collections_controller.php, line 275]


pls get this reviewed for me and reply. :!:

Thanks in advance,
Sourabh
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: upload file error pls help gettin warning permission denied

Post by panic! »

You need to set the permissions on the folder to 0777.

Do this either in your FTP client or via ssh with this command

chmod 0777 /change-to-your/path/to/upload/directory
Sourabh
Forum Newbie
Posts: 7
Joined: Sat Sep 13, 2008 2:18 am

Re: upload file error pls help gettin warning permission denied

Post by Sourabh »

Thanks buddy

This was one of the issue
another thing I had to do is that I had do some modifications in the path seperators(/,\)

Thanks,
Sourabh
Post Reply