Advertisement
Guest User

Untitled

a guest
Aug 17th, 2012
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <?php
  2. $target = "upload/";
  3. $target = $target . basename( $_FILES['uploaded']['name']) ;
  4. $ok=1;
  5.  
  6. //This is our size condition
  7. if ($uploaded_size > 350000)
  8. {
  9. echo "Your file is too large.<br>";
  10. $ok=0;
  11. }
  12.  
  13. //This is our limit file type condition
  14. if ($uploaded_type =="text/php")
  15. {
  16. echo "No PHP files<br>";
  17. $ok=0;
  18. }
  19.  
  20. //Here we check that $ok was not set to 0 by an error
  21. if ($ok==0)
  22. {
  23. Echo "Sorry your file was not uploaded";
  24. }
  25.  
  26. //If everything is ok we try to upload it
  27. else
  28. {
  29. if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
  30. {
  31. echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
  32. }
  33. else
  34. {
  35. echo "Sorry, there was a problem uploading your file.";
  36. }
  37. }
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement