Give help. Get help.

  • # September 22, 2009 at 6:46 pm

    Okay, so I’m trying to upload an image and I keep getting this error message:
    Notice: Array to string conversion in [filename]/write.php on line 23

    Ok, here’s the offending code.

    $image = $_FILES[‘postimage’];
    $imagename = $image[‘name’];
    $tmp = $image[‘tmp_name’];
    $target = “../article/images/$imagename”;
    move_uploaded_file($tmp, $target);

    Can anybody tell what is wrong? Thanks a bunch!

    # September 22, 2009 at 11:04 pm

    there is no way to tell for sure. You can’t post a few lines of code and expect the answer to be in there. The problem could be where you wrote the code for the array. Did you write this code? I would suggest that you google

    Array to string conversion

    This should give you a real good clue on how to fix this issue. I would think someone would need to see all your code to fix this kind of issue

    # September 23, 2009 at 7:19 am

    Alright, I’ll try it out.

    EDIT: Got it working. Just had to make sure that the image name was a string, and I got rid of:

    $image = $_FILES[‘postimage’];
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.