Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End [Solved] Strange Error

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26212
    Cabbage Song
    Member

    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.

    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!

    #64590
    cybershot
    Participant

    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

    #64602
    Cabbage Song
    Member

    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:

    Code:
    $image = $_FILES[‘postimage’];
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.