Hi guys,

I currently have a site that lets the user upload a image into the DB blob fields... The user can replace the image in the db with a new one.

Note: At one stage I did try to put the path into the DB, but I couldn't get it to work so I am back to putting images in the DB.

However it just doesn't work, with basically the same code. I get the confirmation message but when I go to take a look theres nothing there. In phpmyadmin the blob has (6.5 KB) but I don't know why as the image isnt that size.

Code:
PHP Code:
       //code in image path
      
$filepath1='/.../img/.../';
    
$filepath1 .=$_REQUEST['picture1'];
    
//handle code for first image
    
$isize=filesize($filepath1);
    
$hndl=fopen($filepath1,"rb");
    
//Display error message if no file is uploaded
    
if (!$hndl) {
    echo 
"Cannot open file"; }
    
//Add image data to variable for inserting
    
$imgdata="";
    while(!
feof($hndl)){
    
$imgdata.=fread($hndl,$isize);
    }; 
    
$imgdata=addslashes($imgdata);    

     
//insert new product details into the product table
        
$sql "UPDATE product SET 
    ProductImage = '"
$imgdata ."'
    WHERE ProductID = '
$productid'";

    
$result mysql_query($sql);

    
//close handles
    
fclose($hndl); 
    exit; 
Am not sure why as its the same code as the INSERT, with basically just "UPDATE" changed. Thanks for your help.