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

  • SEARCH
  • Home
  • 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 7691097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:32:43+00:00 2026-05-31T20:32:43+00:00

I am trying to get the following code to work: if (isset($_POST[‘file’])){ if(file_exists($_POST[‘file’])){ echo

  • 0

I am trying to get the following code to work:

if (isset($_POST['file'])){
    if(file_exists($_POST['file'])){
        echo "here";
        $fixture = simplexml_load_file($_POST['file']) or die ('error');
    }
}

It echoes the ‘here’ but it does not load the file.

Any ideas?


<HTML>
<HEAD>
<TITLE>File Upload</TITLE>
</HEAD>
<BODY>
<?php
if ((($_FILES["file"]["type"] == "text/xml"))
&& ($_FILES["file"]["size"] < 20000))
  {
  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(time() . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      time() . $_FILES["file"]["name"]);
      echo "Stored in: " . time() . $_FILES["file"]["name"];
      echo "<form action='league.php' method='post'>";
      echo "<input type='hidden' value='" . time() . 
                    $_FILES["file"]["name"] . "' name='file'>";
      echo "<input type='submit' /></form>";
      }
    }
  }
else
  {
  echo "Invalid file";
  }
?>
</BODY>
</HTML>

The file being uploaded is an XML file and the filename is posted as a hidden variable to the previous code.


<?xml version="1.0"?>
<title>Results</title>
<results>
    <result>
        <hometeam>
            <name>Team A</name>
            <score>6</score>
        </hometeam>
        <awayteam>
            <name>Team B</name>
            <score>0</score>
        </awayteam>
    </result>
</results>
  • 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-05-31T20:32:44+00:00Added an answer on May 31, 2026 at 8:32 pm

    Use libxml_get_errors() to get your detailed errors, or else we just can guess what’s going on.

    <?php
    // somewhere at the top
    libxml_use_internal_errors(true);
    
    // ....
    foreach(libxml_get_errors() as $error) {
      echo $error->message , '(',  $error->file , ':' ,  $error->line , ')<br>';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to PHP and trying to get the following code to work:
I'm trying to get the following bit of code to work in LINQPad but
I'm trying to get HTML5's audio tag to work in Chrome. The following code
I have been trying to get the following code to work(everything is defined in
I am trying to get the following code to work so I can call
I am trying to get the following piece of code to work in a
I am trying to get the following code to work so that the list
I'm trying to get a SwingWorker to work. I've the following code at the
I'm trying to get the following code to work, but it's giving me an
I'm trying to get the following code in my worksheet to work. At the

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.