Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <?php
- if ($_FILES['uploadfile']['error'] > 0 ) {
- echo "Upload error";
- }
- else{
- $filename = $_FILES['uploadfile']['name'];
- $type = $_FILES['uploadfile']['type'];
- $size = $_FILES['uploadfile']['size'];
- $tmp = $_FILES['uploadfile']['tmp_name'];
- $ext = pathinfo($filename ,PATHINFO_EXTENSION);
- $allowed_extension = array("jpg" , "png" , "gif" , "bmp");
- if (in_array($ext,$allowed_extension)){
- move_uploaded_file($tmp,"/var/www/html/uploads/".$filename);
- echo "upload success in : /var/www/html/uploads/" .$filename ;
- }else{
- echo "invaild" ;
- }
- }
- ?>
- <html>
- <body>
- <h1>I'll do it</h1>
- <form action = "upload1.php" method = "post" enctype = "multipart/form-data">
- <input type = "file" name = "uploadfile" />
- <input type = "submit" value = "Upload"/>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement