Support » Fixing WordPress » Cannot upload images (“No such file or directory”)

  • Dear all – I have searched this forum but cannot find the answer I need.

    When I try to upload images I get the following error:-

    —————-
    Warning: getimagesize(/share/HDA_DATA/Qweb/share/blog/wp-content/uploads/2008/03/dscf0001.JPG) [function.getimagesize]: failed to open stream: No such file or directory in /share/HDA_DATA/Qweb/share/blog/wp-admin/includes/image.php on line 143

    Warning: Cannot modify header information – headers already sent by (output started at /share/HDA_DATA/Qweb/share/blog/wp-admin/includes/image.php:143) in /share/HDA_DATA/Qweb/share/blog/wp-includes/pluggable.php on line 390
    —————-

    I have tried resizing the images (JPG) and tried GIFs too, but no joy, I still get the error.

    What is the fix please?

    Thanks
    Scott

Viewing 15 replies - 1 through 15 (of 36 total)
  • Moderator kmessinger

    (@kmessinger)

    It has nothing to do with the size.

    No such file or directory This file, dscf0001.JPG, is not where it is supposed to be.

    Thanks for the reply, kmessinger.

    I am new to WordPress and only installed it for the 1st time recently. I can post messages but I cannot upload any images.

    I am simply trying to upload any image, regardless of size, from my desktop but I have always got this error.

    I am going wrong somewhere please?

    Regards
    Scott

    Moderator kmessinger

    (@kmessinger)

    The headers part of the error normally means there is an extra line at the beginning or at the end of a file. Check image.php for any white space or a line before <? or after ?>.

    Forgot to mention I did have a good look at many posts in this forum and followed advice to check for white space, which I have corrected in some files, including image.php and pluggable.php.

    I am surprised that having just installed WordPress, I would have to manually remove white space from PHP files just to get uploads to work.

    Any other ideas please?

    whooami

    (@whooami)

    Member

    actually. that headers error doesnt mean that. What it means is that output is being sent to the browser when it shouldnt be (its just typically seen in editing files improperly) — in this case its caused by the error in uploading.. the error message itself is causing the headers problem.

    Focus on the upload issue — thats the problem..

    Henderson, have you verified that you actually have the ability to upload files?

    Create a phpinfo.php file:

    <?php phpinfo(); ?>

    Upload that to your web space, and then open it in a browser.

    Look for this:

    file_uploads

    There will be a 1 or a 0 after it

    true = 1
    false = 0

    If its a 0 thats your problem.

    Moderator kmessinger

    (@kmessinger)

    Normally that problem is with wp-config and not files that no one opens but since you opened and did change some files perhaps an error was introduced.

    Did you try deleting the files and then reuploading them?

    Another thing. Can you upload a file with FTP to wp-content/uploads/2008/03/ this directory? Are your permalinks set to default?

    Thanks both.

    I don’t know what permalinks are, so I guess there are default.

    I will try FTP (WSFTP ok?) and let you know.

    Scott

    whooami

    (@whooami)

    Member

    an even better test to narrow down whether or not its you files or a server issue, is to just try to upload outside of WP using a php script.

    here is a very basic upload script that will test whether or not you can even do php uploads — the only diff is that this will use a directory on your site and not what the server is specifying in the global php.ini:

    <?php
    $filepath = "";
    ($_POST['Submit'] != "") {
    	$filename = $_FILES['image']['name'];
    	$file = $_FILES['image']['tmp_name'];
    		if (!(file_exists("$filepath$filename")))
    			{
    		$savedfile = @copy("$file", "$filepath$filename");
    		}
    		if ($savedfile)
    			{
    			echo "File has been uploaded..<br><br>";
    			}
    		else
    			{
    			echo "This file has not been uploaded..!";
    			}
    		}
    echo '<form method="post" action="upload.php"><input name="image" type="file" size="20"><br> <br><input type="submit" name="Submit" value="Upload!" size="20"></form>';

    ?>

    If you copy and paste that into a file named upload.php, put it in its own directory and chmod that directory to 777 you ought to be able to upload ANY file using that. If you cant…

    And actually, that might even use the /tmp dir as well so its an even better test. I should ssh in and watch 🙂

    I have created upload.php and put it in a new folder called “uploads” on my desktop.

    Pardon my ignorance, but how do I initiate an upload please?

    Thanks for your help so far
    Scott

    whooami

    (@whooami)

    Member

    it needs to go on your site. and then you open it on your browser,, just like any other file you put there. 🙂

    Of course! Oops!

    Well, I have copied to my website and browsed to http://www.domain.name/blog/uploads/upload.php but I get:-

    Parse error: syntax error, unexpected ‘{‘ in /share/HDA_DATA/Qweb/website/blog/uploads/upload.php on line 4

    Line 4 in upload.php is:-

    ($_POST[‘Submit’] != “”) {

    Where to go from here please?

    whooami

    (@whooami)

    Member

    thats an issue with your copying and pasting..

    Just go grab this,

    http://www.village-idiot.org/broke/upload.txt

    download that, rename it to upload.php, and replace the one you copied and pasted.

    I followed your instructions and “File has been uploaded successfully!”

    So does that mean there is a problem with my WP installation? If so, what is the best thing I should do please?

    Scott

    Do I just need to replace wp-config.php from the original installation files please?

    Moderator kmessinger

    (@kmessinger)

    When you sent the WP files, you should have received the same message. If not, you probably want to upload them again.

    If you want you can just upload your wp-config file (if you made changes to it) and see what happens. The important thing is now we know you can upload successfully.

    whooami, who I don’t think is logged on yet, may have a different approach.

Viewing 15 replies - 1 through 15 (of 36 total)
  • The topic ‘Cannot upload images (“No such file or directory”)’ is closed to new replies.