1 Replies - 2037 Views - Last Post: 12 January 2011 - 10:08 PM

#1 William_Wilson   User is offline

  • lost in compilation
  • member icon

Reputation: 207
  • View blog
  • Posts: 4,812
  • Joined: 23-December 05

upload files

Posted 12 July 2006 - 09:49 AM

Description: create the first php file named "uploader.php" then create a folder named uploads at the same level, and save the html form as well.using a form and php to upload files to your server
<?php
$target_path = "uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}?>

//The form used to apply this uploading:
<form enctype="multipart/form-data" action="uploader.php" method="POST">
     <input type="hidden" name="MAX_FILE_SIZE" value="1000" />
     Upload File: <input name="uploadedfile" type="file" /> 

     <input type="submit" value="Upload File" />
     </form>


Is This A Good Question/Topic? 0
  • +

Replies To: upload files

#2 borninlyoko   User is offline

  • D.I.C Regular
  • member icon

Reputation: 7
  • View blog
  • Posts: 350
  • Joined: 03-December 09

Re: upload files

Posted 12 January 2011 - 10:08 PM

Works fine, except only allows one file in the "uploads" folder at a time.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1