Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <?php
  2. if (isset($_POST["update"])) {
  3. $file = $_FILES["file"];
  4. $fileName = $file["name"];
  5. $fileTMP = $file["tmp_name"];
  6. $fileSize = $file["size"];
  7. $fileType = $file["type"];
  8. $fileError = $file["error"];
  9.  
  10. $fileExp = explode(".", $fileName);
  11. $fileExpAct = strtolower(end($fileExp));
  12. $allowed = array("jpg","jpeg","png","gif");
  13. if (in_array($fileExpAct,$allowed)) {
  14. if ($fileError === 0) {
  15. if ($fileSize < 10000000) {
  16. $fileNewName = uniqid("",true).".".$fileExpAct;
  17. $destination = "upload/".$fileNewName;
  18. move_uploaded_file($fileTMP, $destination);
  19. header("Location: index.php?success");
  20. }
  21. }
  22. }
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement