Jump to content

[SOLVED] File Upload Help


monkeypaw201

Recommended Posts

The code is just posting to same page and nothing happens...

 

<?php
if(isset($_FILES['file']))
{
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo "File Uploaded Successfully";

    if (file_exists("../downloads/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      $filename = date("siHdmY");
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "upload/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "../downloads/" . $filename;
      }
    }
}else{
?>
<form method="POST" action="upload.php">

<p>Pilot ID:<br>
<input type="text" name="pilot_id">
<p>File:<br>
<input type="file" name="file">
<p>Title:<br>
<input type="text" name="title">
<p>Description:<br>
<textarea name="description"></textarea>
<p>Author:<br>
<input type="text" name="author">
<p><input type="submit" name="submit" value="Upload File">
</form>
<?php
}
?>

 

NOTE: Its not done, but eventually it will insert Title, Author, Description, Pilot ID into database along with $filename.

Link to comment
https://forums.phpfreaks.com/topic/116337-solved-file-upload-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.