Advertisement
Guest User

upload

a guest
Dec 19th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <form action="UploadFile.php" method="post" enctype= "multipart/form-data">
  2.  
  3. Select Image:<input type="file" name="image">
  4. <input type="submit" name="upload" value="Upload Now">
  5.  
  6. </form>
  7.  
  8. <?php
  9. if(isset($_POST['upload'])){
  10.  
  11. $image_name = $_FILES['image']['name'];
  12. $image_type = $_FILES['image']['type'];
  13. $image_size = $_FILES['image']['size'];
  14. $image_tmp_name = $_FILES['image']['tmp_name'];
  15.  
  16. if($image_name==''){
  17. echo "<script> alert('select image')</script>";
  18. exit();
  19. }
  20. else
  21. move_uploaded_file($image_tmp_name,"photos/$image_name");
  22.  
  23. echo "File Uploaded Successfully";
  24.  
  25. }
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement