Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm having trouble uploading a custom image into Wordpress' dashboard. It says that it needs to be a custom 1000x288 image. When I upload it, I get the error of:

Warning: copy(/var/sites/zeldezine/wordpress/wp-content/uploads/2012/02/header.jpg) [function.copy]: failed to open stream: Permission denied in /var/sites/zeldezine/wordpress/wp-admin/includes/file.php on line 348


Warning: getimagesize(/var/sites/zeldezine/wordpress/wp-content/uploads/2012/02/header.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /var/sites/zeldezine/wordpress/wp-admin/custom-header.php on line 665

When I open /includes/file.php, I get this block of code on line 348

// Set correct file permissions
    $stat = stat( dirname( $new_file ));
    $perms = $stat['mode'] & 0000666;
    @ chmod( $new_file, $perms );

but I am not experienced enough in PHP to be able to know how to set the permissions correctly. If anyone can give me a heads up on what I need to modify to set permissions correctly, I'd appreciate it.

share|improve this question

migrated from stackoverflow.com Feb 8 '12 at 15:07

This question came from our site for professional and enthusiast programmers.

    
Do you have write access to your wordpress installation directory? –  mrtsherman Feb 8 '12 at 3:33
    
@mrtsherman: Yes –  Matt Zelenak Feb 8 '12 at 3:40
    
@MattZelenak are you sure? :) What are the file permissions on /uploads... as a test, set the permissions on /var/sites/zeldezine/wordpress/wp-content/uploads/2012/02/ to 0777 and see if it works. –  Ben D Feb 8 '12 at 3:42
    
@Ben D: Many thanks! Works perfectly. So what was I doing wrong? It was already set to 777, but I added the 'write' permission to group & other. –  Matt Zelenak Feb 8 '12 at 4:03
    
You should make sure that 777, write permission is set directly on the uploads folder... as you can see, Wordpress will generate sub folders based on year/month –  Jeffery A Wooden Feb 8 '12 at 4:10

2 Answers 2

Please Give the permission to Folder uploads to 755 and its subfolders.

share|improve this answer

whenever you upload something , wordpress will automatically generate sub-folders inside 'uploads' based on the current date (year and month) , so avoid being stupid and keep modifying the permission of each folder generated inside uploads directory, rather set the permissions of the uploads folder to '755', it will automatically applied to its sub-directories.

share|improve this answer
3  
It is not advisable to set ANY part of the WordPress directory/file structure to world-writable. The Codex recommends 755. –  Chip Bennett Feb 8 '12 at 18:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.