Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP code parse error

Options
  • 09-11-2010 4:43pm
    #1
    Registered Users Posts: 123 ✭✭


    I'm using this code:

    [PHP]<?php
    if ((($_FILES["file"]["type"] == "image/gif")
    || ($_FILES["file"]["type"] == "image/jpeg")
    || ($_FILES["file"]["type"] == "image/pjpeg"))
    && ($_FILES["file"]["size"] < 2000000))
    {
    if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
    else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file_exists("sub_pages/pictures/uploads/" . $_FILES["file"]["name"]))
    {
    echo $_FILES["file"]["name"] . " already exists. ";
    }
    else
    {
    move_uploaded_file($_FILES["file"]["tmp_name"],
    "sub_pages/pictures/uploads/" . $_FILES["file"]["name"]);
    echo "Stored in: " . "sub_pages/pictures/uploads/" . $_FILES["file"]["name"];
    }
    }
    }
    else
    {
    echo "Invalid file";S
    }
    ?>[/PHP]

    for a simple file upload.

    I'm getting this error :

    Parse error: syntax error, unexpected '}' in upload_file.php on line 33.

    Line 33 is the final curly bracket before the end, anyone know why?

    The code is taken from this page:

    http://w3schools.com/php/php_file_upload.asp


Comments

  • Registered Users Posts: 9,193 ✭✭✭RobertFoster


    echo "Invalid file";[b]S[/b]
    
    That S shouldn't be there, it might be the problem you're having.


  • Registered Users Posts: 123 ✭✭ballyrhy86


    echo "Invalid file";[b]S[/b]
    
    That S shouldn't be there, it might be the problem you're having.

    Yeah that was it, thank you!


Advertisement