Page 1 of 1

upload file error pls help gettin warning permission denied

Posted: Sat Sep 13, 2008 9:33 am
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

Re: upload file error pls help gettin warning permission denied

Posted: Sat Sep 13, 2008 9:40 am
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

Re: upload file error pls help gettin warning permission denied

Posted: Sat Sep 13, 2008 11:59 am
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