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.

  • Do you have write access to your wordpress installation directory?
    – mrtsherman
    Commented Feb 8, 2012 at 3:33
  • @mrtsherman: Yes
    – Matt Zelenak
    Commented Feb 8, 2012 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
    Commented Feb 8, 2012 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
    Commented Feb 8, 2012 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
    Commented Feb 8, 2012 at 4:10

2 Answers 2


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


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.

  • 3
    It is not advisable to set ANY part of the WordPress directory/file structure to world-writable. The Codex recommends 755. Commented Feb 8, 2012 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.