amarullz

Untitled

Mar 5th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. $target_dir = "./up/";
  3. $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
  4. $uploadOk = 1;
  5. $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
  6. // Check if image file is a actual image or fake image
  7. if(isset($_POST["submit"])) {
  8. $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
  9. if(copy($_FILES["fileToUpload"]["tmp_name"],$target_file)) {
  10. echo "Upload OK";
  11. } else {
  12. echo "Upload Error";
  13. }
  14. }
  15. ?>
  16.  
  17. <!DOCTYPE html>
  18. <html>
  19. <body>
  20.  
  21. <form action="index.php" method="post" enctype="multipart/form-data">
  22. Select image to upload:
  23. <input type="file" name="fileToUpload" id="fileToUpload">
  24. <input type="submit" value="Upload Image" name="submit">
  25. </form>
  26.  
  27. </body>
  28. </html>
Advertisement
Add Comment
Please, Sign In to add comment