Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if($_POST['submit']){
- $target_path = "files/";
- $target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
- if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
- echo "The file ". basename( $_FILES['uploadedfile']['name']).
- " has been uploaded. <a href='files'>File Listing</a>";
- } else{
- echo "There was an error uploading the file, please try again!";
- }
- echo "<hr>";
- }
- ?>
- <form enctype="multipart/form-data" action="<?php echo __FILE__; ?>" method="POST">
- <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
- Choose a file to upload: <input name="uploadedfile" type="file" /><br />
- <input type="submit" value="Upload File" name='submit'/>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment