Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (empty($_GET["laddar_up"]) == "1")
- {
- if (($_FILES["file"]["size"] < 10000000)
- && ($_FILES["file"]["type"] == "image/jpeg")
- || ($_FILES["file"]["type"] == "image/jpg")
- || ($_FILES["file"]["type"] == "image/pjpeg")
- || ($_FILES["file"]["type"] == "image/gif")
- || ($_FILES["file"]["type"] == "image/png")
- || ($_FILES["file"]["type"] == "image/bnp"))
- {
- $namn = rand(0,10000000000000)."[-]".$_FILES["file"]["name"];
- $to = "upload/" . $namn;
- move_uploaded_file($_FILES["file"]["tmp_name"],$to);
- header('Location: index.php');
- }
- else
- {
- $error = "ERROR. Fel bildtyp eller storlek.";
- }
- }
- ?>
- <html><head>
- <title>Random!</title>
- <style type="text/css">
- body {background-color: #333}
- a {border:0px;}
- img {border:8px solid white}
- div.ladda_up {
- padding:20;
- position:fixed;
- top:0%;
- left:50%;
- width:250px;
- margin-left:-125px;
- background-color:#ffffff;
- opacity: 0.5;
- }
- div.ladda_up:hover {opacity: 1}
- </style>
- </head><body>
- <div class="ladda_up">
- <p style="font-family:verdana;font-size:17px">Ladda Upp En Bild!</p>
- <form action="index.php?laddar_up=1" method="post" enctype="multipart/form-data">
- <input type="file" name="file" id="file" /> <br />
- <input type="submit" name="submit" value="Skicka" />
- <?php echo $error; ?>
- </form>
- </div>
- <div style="padding-bottom:300px;border-top:1px dashed white;"> </div>
- <ul class="item_list">
- <?php
- $files = glob( './upload/*.*' );
- // Sort after last modified
- array_multisort(
- array_map( 'filemtime', $files ),
- SORT_NUMERIC,
- SORT_DESC,
- $files
- );
- foreach ($files as $file) {
- $nice_name = str_replace('./upload/', '', $file);
- $nice_name = explode('[-]', ' ', $nice_name);
- echo '<li style="float:left;"><a href="'.$file.'"><img src="'.$file.'"/></a></li>';
- }
- ?>
- </ul>
- </body>
- </html>
Add Comment
Please, Sign In to add comment