Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. if (isset($_POST['uploadBtn']) && $_POST['uploadBtn'] == 'Upload') {
  2. if (isset($_FILES['file']) && $_FILES['file']['error'] === UPLOAD_ERR_OK) {
  3.  
  4. $fileTmpPath = $_FILES['file']['tmp_name'];
  5. $fileName = $_FILES['file']['name'];
  6. $fileSize = $_FILES['file']['size'];
  7. $fileType = $_FILES['file']['type'];
  8. $fileNameCmps = explode(".", $fileName);
  9. $fileExtension = strtolower(end($fileNameCmps));
  10. $newFileName = md5(time() . $fileName) . '.' . $fileExtension;
  11. $allowedfileExtensions = array('jpg', 'gif', 'png', 'zip', 'txt', 'xls', 'doc');
  12. echo $fileName;
  13.  
  14. if (in_array($fileExtension, $allowedfileExtensions)) {
  15. $uploadFileDir = 'img/';
  16. $dest_path = $uploadFileDir . $newFileName;
  17. echo "vamoos";
  18.  
  19. if(move_uploaded_file($fileTmpPath, $dest_path)) {
  20. $message ='File is successfully uploaded.';
  21. $_SESSION['message'] = $message;
  22. echo $message;
  23. }
  24. else {
  25. $message = 'There was some error moving the file to upload directory. Please make sure the upload directory is writable by web server.';
  26. $_SESSION['message'] = $message;
  27. echo "3";
  28. }
  29. }
  30. }else {echo "algo no funciona1"; }
  31. }else {echo "algo no funciona"; }
  32.  
  33. $selectMeme = $selectPlantilla = "";
  34. $invisibleMeme = $invisiblePlantilla = "invisible";
  35. $error = $selected = "";
  36. if ( isset($_GET['u']) ) {
  37.  
  38. if ( $_GET['u'] == "meme" ) {
  39. $selected = "memes";
  40. $selectMeme = "checked";
  41. $invisibleMeme = "";
  42. $selectPlantilla = "";
  43. $invisiblePlantilla = "invisible";
  44.  
  45. } else {
  46. $selected = "plantillas";
  47. $selectPlantilla = "checked";
  48. $invisiblePlantilla = "";
  49. $selectMeme = "";
  50. $invisibleMeme = "invisible";
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement