hi,
images are stored in MYSQL . What I need to do is to download the images from the database to some predefined directory in the webserver.
I am hoping that someone could help me fixing it.
This code downloads the image to the Desktop. But I want to download the images to the a directory where this php file reside. i.e. if this php file "download.p hp" is in "localhost/images" then I want to download the file to "localhost/images".
Thank You
images are stored in MYSQL . What I need to do is to download the images from the database to some predefined directory in the webserver.
I am hoping that someone could help me fixing it.
Code:
<?PHP
//download.php
mysql_connect('localhost','root','') or die("Unable to connect to SQL server");
@mysql_select_db('test') or die("Unable to select database");
$sqlimage = "SELECT * from pix ";
$sql_imgresult = mysql_query($sqlimage) or die (mysql_error());
header("Content-type: application/force-download");
header("Content-Disposition: attachment; filename=image.img");
while ( $row = mysql_fetch_array ($sql_imgresult) )
{
$picname = $row["imgdata"];
echo "$picname";
}
?>
Thank You
Comment