Guest User

Untitled

a guest
Jul 22nd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. <?php
  2. if (empty($_GET["laddar_up"]) == "1")
  3. {
  4. if (($_FILES["file"]["size"] < 10000000)
  5. && ($_FILES["file"]["type"] == "image/jpeg")
  6. || ($_FILES["file"]["type"] == "image/jpg")
  7. || ($_FILES["file"]["type"] == "image/pjpeg")
  8. || ($_FILES["file"]["type"] == "image/gif")
  9. || ($_FILES["file"]["type"] == "image/png")
  10. || ($_FILES["file"]["type"] == "image/bnp"))
  11. {
  12. $namn = rand(0,10000000000000)."[-]".$_FILES["file"]["name"];
  13. $to = "upload/" . $namn;
  14. move_uploaded_file($_FILES["file"]["tmp_name"],$to);
  15. header('Location: index.php');
  16. }
  17. else
  18. {
  19. $error = "ERROR. Fel bildtyp eller storlek.";
  20. }
  21. }
  22. ?>
  23. <html><head>
  24. <title>Random!</title>
  25.  
  26. <style type="text/css">
  27. body {background-color: #333}
  28. a {border:0px;}
  29. img {border:8px solid white}
  30. div.ladda_up {
  31. padding:20;
  32. position:fixed;
  33. top:0%;
  34. left:50%;
  35. width:250px;
  36. margin-left:-125px;
  37. background-color:#ffffff;
  38. opacity: 0.5;
  39. }
  40. div.ladda_up:hover {opacity: 1}
  41. </style>
  42.  
  43. </head><body>
  44.  
  45.  
  46.  
  47.  
  48. <div class="ladda_up">
  49.  
  50. <p style="font-family:verdana;font-size:17px">Ladda Upp En Bild!</p>
  51.  
  52. <form action="index.php?laddar_up=1" method="post" enctype="multipart/form-data">
  53.  
  54. <input type="file" name="file" id="file" /> <br />
  55.  
  56. <input type="submit" name="submit" value="Skicka" />
  57. <?php echo $error; ?>
  58.  
  59. </form>
  60. </div>
  61.  
  62. <div style="padding-bottom:300px;border-top:1px dashed white;">&nbsp;</div>
  63.  
  64.  
  65. <ul class="item_list">
  66.  
  67. <?php
  68. $files = glob( './upload/*.*' );
  69. // Sort after last modified
  70. array_multisort(
  71. array_map( 'filemtime', $files ),
  72. SORT_NUMERIC,
  73. SORT_DESC,
  74. $files
  75. );
  76.  
  77. foreach ($files as $file) {
  78. $nice_name = str_replace('./upload/', '', $file);
  79. $nice_name = explode('[-]', ' ', $nice_name);
  80. echo '<li style="float:left;"><a href="'.$file.'"><img src="'.$file.'"/></a></li>';
  81. }
  82.  
  83. ?>
  84. </ul>
  85.  
  86.  
  87. </body>
  88. </html>
Add Comment
Please, Sign In to add comment