Guest User

Untitled

a guest
Jan 28th, 2016
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. //Input
  2. <input type="file" accept="image/png, image/jpg, image/jpeg" class="btn-file" name="userfile" style="width: 200px; margin:0 auto; "/>
  3. //Upload Picture
  4. if(is_uploaded_file($_FILES['userfile']['tmp_name']) && getimagesize($_FILES['userfile']['tmp_name']) != false)
  5. {
  6. $size = getimagesize($_FILES['userfile']['tmp_name']);
  7. $type = $size['mime'];
  8. $imgfp = fopen($_FILES['userfile']['tmp_name'], 'rb');
  9. $size = $size[3];
  10. $name = $_FILES['userfile']['name'];
  11. $maxsize = 99999999;
  12. if($_FILES['userfile']['size'] < $maxsize )
  13. {
  14. $picturesql = "INSERT INTO imageblob (image_type ,image, image_size, image_name) VALUES ('".$type."' ,'".$imgfp."', '".$size."', '".$name."');";
  15. mysqli_query($conn, $picturesql);
  16. }
  17. }
  18.  
  19. //Download Picture
  20. $picquery = "SELECT image, image_type FROM imageblob WHERE image_id= 1";
  21. $picstmt= mysqli_query($conn,$picquery);
  22. $countp = 0;
  23. while($rowpic = mysqli_fetch_array($picstmt)){
  24. $Images[$countp] = $rowpic['image'];
  25. $countp++;
  26. echo $Images[$countp];
  27. }
Add Comment
Please, Sign In to add comment