Advertisement
Vendettaaaa

Untitled

Jun 18th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <?php
  3. if ($_FILES['uploadfile']['error'] > 0 ) {
  4. echo "Upload error";
  5. }
  6. else{
  7. $filename = $_FILES['uploadfile']['name'];
  8. $type = $_FILES['uploadfile']['type'];
  9. $size = $_FILES['uploadfile']['size'];
  10. $tmp = $_FILES['uploadfile']['tmp_name'];
  11. $ext = pathinfo($filename ,PATHINFO_EXTENSION);
  12. $allowed_extension = array("jpg" , "png" , "gif" , "bmp");
  13. if (in_array($ext,$allowed_extension)){
  14. move_uploaded_file($tmp,"/var/www/html/uploads/".$filename);
  15. echo "upload success in : /var/www/html/uploads/" .$filename ;
  16. }else{
  17. echo "invaild" ;
  18. }
  19. }
  20. ?>
  21. <html>
  22. <body>
  23.  
  24. <h1>I'll do it</h1>
  25. <form action = "upload1.php" method = "post" enctype = "multipart/form-data">
  26. <input type = "file" name = "uploadfile" />
  27. <input type = "submit"  value = "Upload"/>
  28. </body>
  29. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement