Posted By

Tamedo on 05/23/08


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

romanos


php upload files


 / Published in: PHP
 

  1. <?php
  2. if ($_GET['image'] == "1") {
  3. $uploaddir = '../images/';
  4. $uploadfile = $uploaddir . basename($_FILES['image']['name']);
  5.  
  6. if (move_uploaded_file($_FILES['image']['tmp_name'], $uploadfile)) {
  7. echo "File is valid, and was successfully uploaded.\n";
  8. }
  9.  
  10. }
  11. ?>
  12.  
  13. <form enctype="multipart/form-data" action="?image=1" method="POST">
  14. <input type="hidden" name="MAX_FILE_SIZE" value="512000" />
  15. <input name="image" type="file" />
  16. <input type="submit" value="Upload Image" />
  17. </form>

Report this snippet  

You need to login to post a comment.