0
votes

I am confused !!! destination folder is '/uploads'. I can not upload file with PHP to '/uploads' when permission for this folder is 0755 and this error displayed Unable to write in the "/uploads" directory' before script upload I check for username linux by get_current_user() PHP function and that display string(4) root .this mean I logged in by root user and get uploaded file with root user and want to save uploaded with root user.so why permission error occurs ?? when change permission for '/uploads' to '0757' no error display and upload successfully .but I don't want to change permission to '0757' .because that mean other can write to the '/uploads'.

1

1 Answers

2
votes

Which user is your HTTP server running as? Typically it will be something like "www-data". Change the ownership of your uploads folder to "www-data:www-data" and you should be able to save data in there.