Advertisement
jaenudinmaulana69

up

Sep 24th, 2019
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <title>Upload your files</title>
  5. </head>
  6. <body>
  7.   <form enctype="multipart/form-data" action="paok.php" method="POST">
  8.     <p>Upload your file</p>
  9.     <input type="file" name="uploaded_file"></input><br />
  10.     <input type="submit" value="Upload"></input>
  11.   </form>
  12. </body>
  13. </html>
  14. <?PHP
  15.   if(!empty($_FILES['uploaded_file']))
  16.   {
  17.     $path = "hm/";
  18.     $path = $path . basename( $_FILES['uploaded_file']['name']);
  19.  
  20.     if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path)) {
  21.       echo "The file ".  basename( $_FILES['uploaded_file']['name']).
  22.       " has been uploaded";
  23.     } else{
  24.         echo "There was an error uploading the file, please try again!";
  25.     }
  26.   }
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement