Guest User

Untitled

a guest
Jul 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. <html><head>
  2. <title>Random!</title>
  3.  
  4. <style type="text/css">
  5. body {background-color: #333}
  6. a {border:0px;}
  7. img {border:8px solid white}
  8. div.ladda_up {
  9. padding:20;
  10. position:fixed;
  11. top:0%;
  12. left:50%;
  13. width:250px;
  14. margin-left:-125px;
  15. background-color:#ffffff;
  16. opacity: 0.5;
  17. }
  18. div.ladda_up:hover {opacity: 1}
  19. </style>
  20.  
  21. </head><body>
  22.  
  23.  
  24.  
  25.  
  26. <div class="ladda_up">
  27.  
  28. <p style="font-family:verdana;font-size:17px">Ladda Upp En Bild!</p>
  29.  
  30. <form action="index.php" method="post" enctype="multipart/form-data">
  31.  
  32. <input type="file" name="file" id="file" /> <input type="hidden" name="laddar_up" value="1" /> <br />
  33.  
  34. <input type="submit" name="submit" value="Skicka" />
  35.  
  36.  
  37. </form>
  38. </div>
  39.  
  40. <div style="padding-bottom:300px;border-top:1px dashed white;">&nbsp;</div>
  41.  
  42. <?php
  43. if (empty($_POST["laddar_up"]) == false)
  44. {
  45. if (($_FILES["file"]["size"] < 10000000)
  46. && ($_FILES["file"]["type"] == "image/jpeg")
  47. || ($_FILES["file"]["type"] == "image/jpg")
  48. || ($_FILES["file"]["type"] == "image/pjpeg")
  49. || ($_FILES["file"]["type"] == "image/gif")
  50. || ($_FILES["file"]["type"] == "image/png")
  51. || ($_FILES["file"]["type"] == "image/bnp"))
  52. {
  53. $namn = rand(0,10000000000000)."[-]".$_FILES["file"]["name"];
  54. $to = "upload/" . $namn;
  55. move_uploaded_file($_FILES["file"]["tmp_name"],$to);
  56. echo "Uppladdad!" . "<br/>";
  57. }
  58. else
  59. {
  60. echo "ERROR. Fel bildtyp eller storlek.";
  61. }
  62. }
  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