Monday, February 18, 2013

how to insert image blob and read blob mysql image using php

   if (isset($_FILES['img']) && $_FILES['img']['size'] > 0) {

      // Temporary file name stored on the server
       $tmpName  = $_FILES['img']['tmp_name']; 
      // Read the file
      $fp      = fopen($tmpName, 'r');
      $data = fread($fp, filesize($tmpName));
      $data = $data;
      /*insert into mysql query after that select and show*/
     $ext = explode('/', $image_type);
     $name = 'colors';

header("Content-Type: image/gif");
echo $data;    
else {?>
  <form name="f" method="post" action="test.php" enctype="multipart/form-data">
<input type="file" name="img"  />
<input type="submit" name="test" value="imagup" />



No comments:

Post a Comment