I am working on AWS ec2 ubuntu machine. My code is in cakephp. When I try to upload any image with crating new folder, I got following warnings.
Warning (2): mkdir(): Permission denied
[APP/Plugin/Upload/Model/Behavior/UploadBehavior.php, line 1784]
Warning (2): chmod() [function.chmod]: No such file or directory
[APP/Plugin/Upload/Model/Behavior/UploadBehavior.php, line 1785]
Warning (2):
finfo::file(/var/www/html/app/webroot/files/user/image/35/)
[finfo.file]: failed to open stream: No such file or directory
[APP/Plugin/Upload/Model/Behavior/UploadBehavior.php, line 1955]
Warning (2): mkdir() [function.mkdir]: Permission denied
[APP/Plugin/Upload/Model/Behavior/UploadBehavior.php, line 1784]
Warning (2): chmod() [function.chmod]: No such file or directory
[APP/Plugin/Upload/Model/Behavior/UploadBehavior.php, line 1785]
Warning (2):
move_uploaded_file(/var/www/html/app/webroot/files/user/image/35/1439985339.jpg)
[function.move-uploaded-file]: failed to open stream: No such file or
directory [APP/Plugin/Upload/Model/Behavior/UploadBehavior.php, line
349]
Warning (2): move_uploaded_file() [function.move-uploaded-file]:
Unable to move '/tmp/phpqvcdzp' to
'/var/www/html/app/webroot/files/user/image/35/1439985339.jpg'
[APP/Plugin/Upload/Model/Behavior/UploadBehavior.php, line 349]
and code is
protected function _mkPath(Model $model, $field, $destDir) {
if (!file_exists($destDir)) {
mkdir($destDir, $this->settings[$model->alias][$field]['mode'], true);
chmod($destDir, $this->settings[$model->alias][$field]['mode']);
}
return true;
}
following is the plugin I am using
http://github.com/josegonzalez/cakephp-upload
should I need to give 777 permission to webroot
Related
When a user uploads a file and I want to move it from temp directory to upload directory, I got this error message in the browser:
Warning: move_uploaded_file(/var/www/html/crm/upload/36379.jpg): failed to open stream: Permission denied in /var/www/html/crm/register_free_adviser.php on line 373
Warning: move_uploaded_file(): Unable to move '/tmp/phpeXf3DM' to '/var/www/html/crm/upload/36379.jpg' in /var/www/html/crm/register_free_adviser.php on line 373
bool(false)
OS: centOS 7
the project works fine on my system which runs windows,XAMPP,apache. but on my server which runs centOS I have issues.
I tried this solution but the problem didn't get solved.
I keep getting these error messages when using a plug in "üsers ultra pro":
Warning: mkdir(): No such file or directory in /homepages/2/d644181673/htdocs/app646332697/wp-content/plugins/users-ultra-pro/xooclasses/xoo.userultra.customizer.php on line 227
Warning: move_uploaded_file(/homepages/2/d644181673/htdocs/app646332697/usersultramedia/custom_avatar_image/uultra_default_avatar_image_.jpg): failed to open stream: No such file or directory in /homepages/2/d644181673/htdocs/app646332697/wp-content/plugins/users-ultra-pro/xooclasses/xoo.userultra.customizer.php on line 230
Warning: move_uploaded_file(): Unable to move '/tmp/phpTloN3B' to '/homepages/2/d644181673/htdocs/app646332697/usersultramedia/custom_avatar_image/uultra_default_avatar_image_.jpg' in /homepages/2/d644181673/htdocs/app646332697/wp-content/plugins/users-ultra-pro/xooclasses/xoo.userultra.customizer.php on line 230
Warning: getimagesize(/homepages/2/d644181673/htdocs/app646332697/usersultramedia/custom_avatar_image/uultra_default_avatar_image_.jpg): failed to open stream: No such file or directory in /homepages/2/d644181673/htdocs/app646332697/wp-content/plugins/users-ultra-pro/xooclasses/xoo.userultra.customizer.php on line 234
I have checked all the permissions are set to 755 but it still won't work. Any ideas? Thanks :)
Background: I am running a multi user site on Wordpress (think pinterest) where users will be able to upload images/text.
I have photo upload on my site and it is working well when I was testing it on localhost. This is how and where the photo I uploaded on my localhost:
if($_FILES['file']['error'][$key] == 0 &&
move_uploaded_file($_FILES['file']['tmp_name'][$key],
"../gallery/{$gallery_images}"
)
){
....
}
But when I tried this on a webserver, it started showing errors. These are the errors:
Warning: move_uploaded_file(../gallery/289228065.jpg): failed to open stream: Permission denied in /var/www/alumni/admin/create_album.php on line 51
Warning: move_uploaded_file(): Unable to move '/tmp/php3hJjHL' to '../gallery/289228065.jpg' in /var/www/alumni/admin/create_album.php on line 51
Warning: move_uploaded_file(../gallery/2001593678.jpg): failed to open stream: Permission denied in /var/www/alumni/admin/create_album.php on line 51
Warning: move_uploaded_file(): Unable to move '/tmp/phpDiNyPg' to '../gallery/2001593678.jpg' in /var/www/alumni/admin/create_album.php on line 51
What should I do? I tried change the path but the same errors show up.
i'm tring to use php function copy() but appear this error:
Warning: copy(/home/smartsch/public_html/admin/student/photos/1tt) [function.copy]:
failed to open stream: Permission denied in
/home/schoolzs/public_html/admin/student/fileupload.class on line 137
The problem is that folder photos and file inside have all permission 777.I don't understand why happen permission denied!!
Warning: copy(/home/beradioc/public_html/phpfreechat-1.3/src/../data/public/themes/default/sound.swf) [function.copy]: failed to open stream: Permission denied in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 179
Warning: chmod() [function.chmod]: Operation not permitted in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 180
Warning: copy(/home/beradioc/public_html/phpfreechat-1.3/src/../data/public/themes/default/smileys/emoticon_surprised.png) [function.copy]: failed to open stream: Permission denied in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 179
Warning: chmod() [function.chmod]: Operation not permitted in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 180
Warning: copy(/home/beradioc/public_html/phpfreechat-1.3/src/../data/public/themes/default/smileys/emoticon_waii.png) [function.copy]: failed to open stream: Permission denied in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 179
Warning: chmod() [function.chmod]: Operation not permitted in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 180
Warning: copy(/home/beradioc/public_html/phpfreechat-1.3/src/../data/public/themes/default/smileys/weather_sun.png) [function.copy]: failed to open stream: Permission denied in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 179
Warning: chmod() [function.chmod]: Operation not permitted in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 180
Warning: copy(/home/beradioc/public_html/phpfreechat-1.3/src/../data/public/themes/default/smileys/weather_cloudy.png) [function.copy]: failed to open stream: Permission denied in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 179
Warning: chmod() [function.chmod]: Operation not permitted in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 180
Your script does not have permissions.
If you are running on your own server, use chmod. If you're running on shared hosting, try chaning permissions anyway, but it's not granted you'll be successful.
chmod is a command for changing permissions on files and/or directories it would appear that your script does not have sufficient permissions to do so, or to copy files around. I would seriously recommend that you study up on file permission, maybe read the READMe for phpfreechat which will probably tell you what those permissions are and go from there. If you do not have ssh access or direct access to your web server, you will probably need some help from your hosting company after you find out what files ad directories need what permissions.
a quick look at phpfreechat's page states:
Give the web server's write permissions to “phpfreechat-x.x/data/public” and “phpfreechat-x.x/data/private” directories.
If you are using FTP:
CHMOD 777 phpfreechat-x.x/data/private
CHMOD 777 phpfreechat-x.x/data/public
If you are using SSH:
chmod 777 phpfreechat-x.x/data/*