Php Uploader

Discussion in 'PHP' started by nrodes, Sep 24, 2008.

  1. #1
    I am not an experienced php programmer.

    I am trying to make an uploader for my website. I found some copy and paste php code online. It gave my directions to make an uploader. Right now I have a form that gives upload.php their data.

    I've tried my uploader. My browser says:

    Parse error: syntax error, unexpected ',' in C:\Program Files\Abyss Web Server\htdocs\Start\upload\upload.php on line 7

    My php code is:

    <?php
    $target = "/Stuart";
    $target = $target . basename( $_FILES['uploaded']['name']) ;
    $ok=1;

    //This is our size condition
    if ($uploaded_size > 1,000,000)
    {
    echo "Tutu, Your file is too large. You might be a Hacker!.<br>";
    $ok=0;
    }


    //Here we check that $ok was not set to 0 by an error
    if ($ok==0)
    {
    Echo "Sorry your file was not uploaded";
    }

    //If everything is ok we try to upload it
    else
    {
    if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
    {
    echo "Your File has been uploaded";
    }
    else
    {
    echo "Sorry, there was a problem uploading your file.";
    }
    }
    ?>


    Does anyone have any Ideas?:confused:
     
    nrodes, Sep 24, 2008 IP
  2. h0ly lag

    h0ly lag Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if ($uploaded_size > 1,000,000)

    should be

    if ($uploaded_size > 1000000)
     
    h0ly lag, Sep 24, 2008 IP
  3. nrodes

    nrodes Peon

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thank you

    i'll see if it works
     
    nrodes, Sep 24, 2008 IP
  4. nrodes

    nrodes Peon

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I still have some trouble.

    It'll say that it works.

    But it won't put the file in /Stuart

    should I use backslashes?

    Should I put a slash after it?
     
    nrodes, Sep 24, 2008 IP
  5. nrodes

    nrodes Peon

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I have another problem.

    My browser says:

    Warning: move_uploaded_file(/Stuart/Najisitetemp.htm) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\Program Files\Abyss Web Server\htdocs\Start\upload\upload.php on line 23

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\Documents and Settings\Peg Stu and Naji\Local Settings\Temp\php485.tmp' to '/Stuart/Najisitetemp.htm' in C:\Program Files\Abyss Web Server\htdocs\Start\upload\upload.php on line 23
    Sorry, there was a problem uploading your file.
     
    nrodes, Sep 24, 2008 IP