Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

PHP code parse error

  • 09-11-2010 04:43PM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 Posts: 9,446 ✭✭✭RobertFoster


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


  • Registered Users, Registered Users 2 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