hi
i'm using a liitle script to insert images in a mssql database. yes i
know i'm not supposed to store images in a database, but after my
images are only 3kb in size, i've decided to do it anyway.
question: how would it be possible to get one of this images back on
my disc? i've been looking through many posting in different forums.
but all of them are hard to understand if you don't have any
experiences using php. the code below is as far as i could get by now.
but the downloaded file is only 318 bytes in size and can not be
displayed. so obviously, my code is crep! but what am i doing wrong?
2. question: can a file be downloaded without prompting the user in
advance? the whole application i'writing is for inhouse use only and
therefor, the user should trust these files...
any help would greatly appreciated!!
best regards
$db = mssql_connect("xxxx","xxxx","xxxx") or die("Can't connect to
mssql server.");
mssql_select_db("xxxx", $db) or die("Can't select database.");
$get_image = "SELECT IMAGE_BIN,IMAGE_NAME FROM dbo.IMAGE WHERE ID_GCP
=51 And ID_LEVEL_IMG=2";
$get_image_result = mssql_query($get_image) or die("Couldn't get
image.");
$binary = @mssql_result($get_image_result,0,"IMAGE_BIN");
$name = @mssql_result($get_image_result,0,"IMAGE_NAME");
header("Content-Disposition: attachment; filename=$name");
header("content-Type: attachment; image/jpeg");