move_uploaded_file wierd behaviour

Discussion in 'PHP' started by biggie_mac, Aug 3, 2008.

  1. #1
    Hi,

    I have a simple php upload script. Works like a charm on local computer. When I put the files online, the script doesn't work anymore.The wierd thing is that the
    $_FILES['uploaded']['error'] variable shows 0 value. As far as I remember, 0 means file was uploaded succesfully. the code is pretty basic:

    if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
    {print("success"); }
    else
    {echo $_FILES['uploaded']['error']; echo "Sorry, there was a problem uploading your file: !";}
    Code (markup):
    so when I try to upload the file I get
    0
    Sorry, there was a problem uploading your file: !

    is there any way I can find out what can be the problem? I tried printing mysql_error() but doesn't return anythig. Is there another way I can find out what is the problem?

    10x in advance
     
    biggie_mac, Aug 3, 2008 IP
  2. Hallent

    Hallent Peon

    Messages:
    65
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    well based on the snippet you pasted $_FILES['uploaded']['error'] is not where you are going to find your issue....

    if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
    would be your issue... i assume either $target path does not exist or you do not have permissions to upload to that folder.
     
    Hallent, Aug 3, 2008 IP