Guest User

Untitled

a guest
Apr 12th, 2019
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['submit'])) {
  3. $file = $_FILES['file'];
  4. $fileName = $_FILES['file']['name'];
  5. $fileTmpName = $_FILES['file']['tmp_name'];
  6. $fileSize = $_FILES['file']['size'];
  7. $fileError = $_FILES['file']['error'];
  8. $fileType = $_FILES['file']['type'];
  9.  
  10. $fileExt = explode('.', $fileName);
  11. $fileActualExt = strtolower(end($fileExt));
  12.  
  13. $allowed = array('jpg','jpeg','png','mov','mp4','mp3');
  14.  
  15. if(in_array($fileActualExt, $allowed)) {
  16. if($fileError === 0) {
  17. if($fileSize < 2000000) {
  18. $fileNameNew = uniqid('', true).".".$fileActualExt;
  19.  
  20. $fileDestination = 'uploadfile/'.$fileNameNew;
  21. move_uploaded_file($fileTmpName, $fileDestination);
  22. header("Location: fertig.php");
  23.  
  24. }else{
  25. echo "Die Datei ist zu groß, maximal 2GB!";
  26. }
  27.  
  28. }else{
  29. echo "Es ist ein Fehler aufgetreten, bitte lade die Seite neu und versuche es erneut!";
  30. }
  31.  
  32. }else{
  33. echo "Dieser Datei Typ wird nicht unterschützt!";
  34. }
  35.  
  36. }
Add Comment
Please, Sign In to add comment