1,105,416 Community Members

no errors being thrown????

Member Avatar
GraficRegret
Junior Poster
182 posts since Nov 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 2 [?]
Skill Endorsements: 0 [?]
 
0
 

ok so here is the code I am working with,

<?php
include 'database/conection.php';

$allowedExts = array("jpg", "jpeg", "gif", "png");
$extension = end(explode(".", $_FILES["file"]["name"]));
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000000)
&& in_array($extension, $allowedExts))
  {
  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 />";

    if (file_exists("pics/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "pics/" . $_FILES["file"]["name"]);

      $path = "pics/" . $_FILES["file"]["name"];

      header('Location:testpage.php');
      }
    }
  }
else
  {
  echo "Invalid file";
  }

?>

and I have tried putting in the followint debugging code

error_reporting(E_ALL);
ini_set('display_errors', 1);

at the beginning of my code, however no errors are thrown at me it just sits there on the page I and does nothing after processing for a minute, here is the code for the refering page:

<html>
<head>
<?php include 'conection.php';?>
<title>
</title>
</head>
<body>
<form action = "insert.php" method = "post"></br>

Announcement: <TEXTAREA name = "announ" ROWS = 10 COLS = 30/>
<?php
$query = "SELECT announcement FROM Announcements";

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

while($row = mysql_fetch_array($result))
    {
        echo $row['announcement'];
    }?>
    </TEXTAREA></br>
<input type = "submit" />
<a href="logout.php"><input type = "button" value = "Logout" onClick="session_destroy()"></a>
</form>
<form action="upload.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" /><br /><br />
<label for="filePath">Stored:<?php echo "$path"?></label>
</form>

</body>
</html>

Please help, I have no idea what to do it just sits there after clicking the submit button for the file upload.

Question Self-Answered as of 1 Year Ago
Member Avatar
GraficRegret
Junior Poster
182 posts since Nov 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 2 [?]
Skill Endorsements: 0 [?]
 
0
 

nevermind guys I figured it out after I commented out the code redirecting me to the orrigionating page thanks

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article