Thanks,
Denise
Moderator: General Moderators
Code: Select all
$file = $HTTP_POST_FILESї'userfile']ї'tmp_name'];
$fp = fopen($file,"r");
$raw = fread($fp,filesize($file));
fclose($fp);
$sql = "INSERT INTO images VALUE('".$file."','".$raw."')";
if(mysql_query($sql)){
echo "Image ".$file." was inserted into the database";
}Code: Select all
$sql = "SELECT blob_field FROM images WHERE name='".$name."'";
$result = mysql_query($sql);
list($raw) = mysql_fetch_assoc($result);
mysql_free_result($result);
header("content-type: image/gif
");
echo $raw;Dusty,dusty wrote:storing images in mysql isn't recommended. you're better off storing the pictures on the server and linking to them in the db.
Code: Select all
if(copy($image, "$dir/" . $image_name)) {
mysql_query("INSERT INTO table VALUES('$image_name');
unlink($image);
}Dusty - I can't even sucessfully enter the path into the table. I get "you have an error in your syntax, etc.dusty wrote:enter the path/to/image into the image column.
Code: Select all
mysql_query("INSERT INTO table VALUES('$image_name'); you forgot toCode: Select all
mysql_query("INSERT INTO table VALUES('$image_name')");Code: Select all
echo mysql_error();Ok - you guys are truly awesome.dusty wrote:everything seems fine to me, could you post a little more of your code and give the exact error.