Support » Fixing WordPress » Cannot modify header information – upon upload

  • I get the following error in WordPress when trying to upload:

    The uploaded file could not be moved to /home/mustache/public_html/wp-content/uploads/2007/02.
    Warning: Cannot modify header information – headers already sent by (output started at /home/mustache/public_html/wp-admin/admin-functions.php:1879) in /home/mustache/public_html/wp-includes/functions.php on line 1219

    Of course, line 1879 of admin-functions.php looks like this:

    wp_die( printf( __(‘The uploaded file could not be moved to %s.’ ), $uploads[‘path’] ));

Viewing 11 replies - 1 through 11 (of 11 total)
  • Try this search here on the forums.

    No results show up on the search page. I’m having the exact same issue when trying to upload.

    Hey there,

    actually I had the same problem and I knew before that it had to do with permissions. I changed them, obviously… but no result.
    I erased the ‘uploads’ folder to let it be created again by WP .. no chance actually. The folder was created and still the uploads where not possible.
    Then I changed to another FTP program, I deleted the ‘upload’ folder and then created it again with the ftp and set the permissions again to 777.

    Here we go… it’s working now. 😉

    hope that will help

    Since this post exactly describes my problem I’ll add my woes.

    I teach businesses about the web and have setup around 100 various incarnations of WordPress installations on our server, all without fail. Lately though I have setup 5 all showing the same problem which is:

    The uploaded file could not be moved to /home/**domain**/public_html/wp-content/uploads.
    Warning: Cannot modify header information – headers already sent by (output started at /home/**domain**/public_html/wp-admin/admin-functions.php:1879) in /home/**domain**/public_html/wp-includes/functions.php on line 1219

    Looking at the various posts on this matter it looks like certain FTP software isn’t persisting the settings and what we think is CHMOD777 really isn’t. I’ve tried 2 different FTP applications and also used the hosting control panel to set CHMOD but to no avail. The error persists. Strangely I don’t receive this error on my host but I do on another.

    How much of this is down to the hosting server rather than the FTP software? I’ve combed this forum and tried every trick in the book. Fundamentally, it has to be permissions since it’s a ‘write’ action but it’s certainly stubborn and presenting all sorts of problems for me so despite all the posted threads above, the trouble continues.

    Just been directed to this thread from my post (here).

    Tried deleting and re-creating the folder with 777 permissions, no joy… noticed that all previous uploaded files had owner set as “apache” – so changed the owner of the uploads folder to apache also; no luck with that either.

    Baffled.

    strange thing is that wordpress can create the folder but not move the file from its temp location

    Ed73

    (@ed73)

    I have solved this problem. After an upgrade, the host defaults to read only and I had to create a tmp folder in the root. As part of the host control panel, there is an option to set this new tmp folder as “upload_tmp_dir” in the PHP config settings.

    This solved the upload problem in my case and I’m wondering if this is something that other hosts are doing. If you completely run out of options with the upload problem, get in touch with the host and ask them about “upload_tmp_dir”.

    Basically had these problems with all my installations so far. The solution suggested of repeated checks on the permissions worked for me (basically change the permissions, disconnect, reconnect, change permissions). The problem of seemingly creating folders with 777 permissions but not actually being 777 (rather 755) occurred using both cuteFTP on a PC and Fetch on a mac.

    files uploaded via php are usually uploaded to /tmp

    thats /tmp as it relates to the box, not as it relates to your site, which on a nix box is typically located in /home/your_user_name/

    Ed73 is absolutely correct when he says that can be overridden. If you don’t have a setting in a control panel, its easily configurable via php.ini

    “Headers already sent” is often caused by extraneous blank lines after the closing ?> php tag. If you can locate the php file that has a blank line at the bottom and delete it, then that will usually solve the problem.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Cannot modify header information – upon upload’ is closed to new replies.