List:General Discussion« Previous MessageNext Message »
From:John Craig Date:April 27 1999 1:51pm
Subject:Re: [PHP3][MySQL] Upload file into database
View as plain text  
>  I have a MySQL database and I want to upload pictures into a blob
>attribute via web. I know how to upload a file but I don't know how to
>insert it into my blob.


don't know if it's the best way to do it, but seems to work OK.

$fp = fopen('big.file.jpg', 'r');
$jpg = fread($fp, filesize('big.file.jpg));
fclose($fp);
$db->query("update table set blob_field = '".base64_encode($jpg)."' where
...


JC

Thread
[PHP3][MySQL] Upload file into databasePhilippe27 Apr
Re: [PHP3][MySQL] Upload file into databaseJohn Craig27 Apr
  • Re: [PHP3][MySQL] Upload file into databasePhilippe27 Apr
    • Re: [PHP3][MySQL] Upload file into databaseunknown27 Apr
  • Re: [PHP3][MySQL] Upload file into databasePhilippe27 Apr
Re: [PHP3][MySQL] Upload file into databaseJohn Craig27 Apr