Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <?php
- if(isset($_FILES["file"]["error"]))
- {
- if ($_FILES["file"]["error"] > 0)
- {
- echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
- }
- elseif ($_FILES["file"]["size"] > 0)
- {
- echo "Upload: " . $_FILES["file"]["name"] . "<br />";
- echo "Type: " . $_FILES["file"]["type"] . "<br />";
- echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
- echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
- $filename = $_FILES["file"]["name"];
- if(strtoupper(substr($filename, -4)) == ".PHP") $filename = $filename . "_";
- // if(strtoupper(substr($filename, -4)) == ".EXE") $filename = $filename . "_";
- while (file_exists("upload/" . $filename))
- {
- $filename = "1" . $filename;
- }
- move_uploaded_file($_FILES["file"]["tmp_name"],
- "/var/www/upload/" . $filename);
- echo "Stored in: " . "<a href=\"upload/" . $filename . "\">upload/" . $filename . "</a><br><br>";
- }
- }
- ?>
- This will upload any files to <a href="upload/">upload/</a>
- <br>Uploaded file ending with '.PHP' will end with '_', to show PHP code instead of running it.
- <br>
- <br><form method="post" enctype="multipart/form-data">
- <label for="file">Filename:</label>
- <input type="file" name="file" id="file" />
- <br />
- <input type="submit" name="submit" value="Submit" />
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment