Advertisement
Guest User

Untitled

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