Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9091575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:38:35+00:00 2026-06-16T22:38:35+00:00

I am getting this error: Parse error: syntax error, unexpected end of file in

  • 0

I am getting this error:

Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\Task2PHP\final\upload.php on line 205

I cannot find what’s causing the problem, as all PHP blocks are opened and closes

    <?php
    include("login.php");

?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

    <title>FileStore - Upload Files</title>
    <link rel="stylesheet" href="./CSS/style.css" type="text/css" media="screen, projection" />
</head>

<body>

<div id="wrapper">

    <header id="header">


    <div id="header-content">
        <strong><h1>FileStore</h1></strong> Upload multiple files at once!
    </div>

    <div class="login-info" >

<?php



    if ($isLoggedin === false) {
        echo '  <form action="" method="POST">
                    Username: <input name="username" > 
                    Password: <input type="password" name="password" size="8">
                              <input type="submit" name="submit" value="Login">
                </form>';
        echo "<p align='right'>You are not logged in.</p>";
        echo "<b><a href='registration.php'>Register</a></b>";


    }else{  
        echo $welcomeMsg;
    }   
?>

    </div>


    </header><!-- #header-->

    <section id="middle" align="center">

        <div id="container">

        <br><br>
            <div id="content">
                <strong><h1>Upload files</h1></strong><br><br>

                <div id="upload-file" >

<?php 


                    include("dbConfig.php");

                    $Username = $_SESSION["username"];

                    global $userid;

                    $Password = $_SESSION["password"];

                    $Password = md5($Password);

                    $sql = "SELECT UserID FROM users WHERE Username = '".$Username."'";

                    $result = mysql_query($sql) or die(mysql_error());

                    while($row = mysql_fetch_assoc($result)) {

                            $userid = $row['UserID'];

                    }


                    echo $userid;

                    $dirname = (string)$userid;

                    $filename = ("/folder/" . "$dirname" . "/");

                    if (!file_exists($filename))

                    {

                                mkdir("files/$dirname", 0777);

                                if (isset($_FILES['files'])) {

                                echo "<div id='files_table'><table class='center'.><tr><td>";

                                $dest = ("files/" . $dirname . "{$_FILES['files']['name'][$key]}");

                                foreach($_FILES['files']['tmp_name'] as $key => $tmp_name){

                                move_uploaded_file($tmp_name, $dest );

                                echo $_FILES['files']['name'][$key], " uploaded.", "<br>";

                                }

                    } else {


                            if (isset($_FILES['files'])) {

                            echo "<div id='files_table'><table class='center'.><tr><td>";

                                $dest = ("files/" . $dirname . "{$_FILES['files']['name'][$key]}");

                                foreach($_FILES['files']['tmp_name'] as $key => $tmp_name){

                                move_uploaded_file($tmp_name, $dest );

                                echo $_FILES['files']['name'][$key], " uploaded.", "<br>";


                        }
                        echo "</td></tr></table></div><br><br>";
                        }




                    // }




                        // if (isset($_FILES['files'])) {

                        // echo "<div id='files_table'><table class='center'.><tr><td>";



                                // foreach($_FILES['files']['tmp_name'] as $key => $tmp_name){

                                // move_uploaded_file($tmp_name, "files/'".$userid."'{$_FILES['files']['name'][$key]}");

                                // echo $_FILES['files']['name'][$key], " uploaded.", "<br>";


                        // }
                        // echo "</td></tr></table></div><br><br>";
                        // }

?>
                    <form action="" method="post" enctype="multipart/form-data">

                            <h1> Select files to upload:</h1>
                            <br>
                            <p>
                                <input type="file" name ="files[]" multiple min="1" /> 
                                <input type="submit" value="Upload" />
                            </p>
                            <br>
                            <h2> You can select multiple files for upload. </h2>

                    </form>

        </div>

            </div><!-- #content-->
        </div><!-- #container-->

        <aside id="sideLeft">

            <div id="menu-x" align="center"><br>
            <strong>Menu</strong><br><br>

                    <div class="menu">
                        <ul>
                        <li><a href="index.php">Home</a></li>
                        <li><a href="upload.php">Upload</a></li>
                        <li><a href="files.php">Files</a></li>
                        <li><a href="about.php">About</a></li>
                        <li><a href="help.php">Help</a></li>
                        <li><a href="#">Logout</a></li>
                        </ul>
                        <br style="clear:left"/>
                    </div>

            </div>


        </aside><!-- #sideLeft -->

    </section><!-- #middle-->

    <footer id="footer">
        <strong>FileStore:</strong> A CMT 3315 Project by Brian Livori
    </footer><!-- #footer -->

</div><!-- #wrapper -->

</body>
</html>

Also, I am trying to create a directory linked to the User’s UserID (MySQL) with mkdir. The directory is created, however, files are not uploaded into the new directory.

Any help please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:38:36+00:00Added an answer on June 16, 2026 at 10:38 pm

    You have an unclosed { which is causing this error. If you indented your code correctly this wouldn’t happen.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm getting this error: Parse error: syntax error, unexpected T_PRINT, expecting T_STRING in /homepages/26/d94605010/htdocs/lz/writecodeonline.com/php/index.php(190)
im getting this error: Parse error: syntax error, unexpected T_ECHO in /home/labvc/public_html/AT/site/getimages.php on line
I am getting this error : Parse error: syntax error, unexpected T_OBJECT_OPERATOR in wp-content/themes/phil/page.php
I am getting this error: Parse error: syntax error, unexpected T_SL on line 23
can you help i'm getting a Parse error: syntax error, unexpected end of file
I keep getting a Parse error: syntax error, unexpected T_STRING in /newref-exec.php on line
I am getting this error Parse error : syntax error, unexpected T_STRING in /ho.../ssd/recording-goodbye.php
I'm getting this error: PHP Parse error: syntax error, unexpected T_VARIABLE in /var/www/vhosts/... on
I am getting this error: PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING When I
I am getting Parse error: syntax error, unexpected ',' in /xxx/login.php on line 28

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.