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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

PHP code parse error

  • 09-11-2010 3: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,347 ✭✭✭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