Advertisement
Guest User

vitor

a guest
Mar 28th, 2009
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. <?php
  2.  
  3. if (isset($_POST['key']) && $_POST['key'] == "12345") {
  4.   // Where the file is going to be placed
  5.   $target_path = "uploads/";
  6.  
  7.   // Add the original filename to our target path.  
  8.   // Result is "uploads/filename.extension"
  9.   $target_path = $target_path . basename( $_FILES['file']['name']);
  10.  
  11.   if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
  12.       echo "The file ".  basename( $_FILES['file']['name']).
  13.       " has been uploaded";
  14.   } else {
  15.       echo "There was an error uploading the file, please try again!";
  16.   }
  17. } else {
  18.   echo "Invalid key.";
  19. }
  20.  
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement