--- On Mon, 10/6/08, zarilahr <[EMAIL PROTECTED]> wrote: > i put up a image in database and i want when a user click > on download link the particular image start to download. I > have stored 100 images in mysql and below is the sample mysql > query i write and its work fine . > > INSERT INTO `mobile`.`stuff` (`prod_id`, `cat_id`, > `image_name`, `image_path`) > VALUES (NULL, '3', 'Impossible ', > 'impossible.jpg'); > > "please note that prod_id is auto increment." > > and here is the php code how i called my all images with > the help of > while loop from mysql. > > echo '<td>' . '<img > src="images/' . $row['image_path'] . > '" > border="0">' . > '<br>' . $row['image_name'] . > '</a> <br />' . '<a > href="images/? > id "> Download </a>' . > '</td>'; > > i want to start download the particular image when i click > on the > Download link. Please tell me the code how i can download > the image > when i click on Download link. > > A screent shot with the name of imagedownlod is attached > which can > clarify what exactly i want. > > regards > Azhar
Wasn't this question already asked in this forum? From your example code, it looks as if you are storing the image file names in the database and not the actual image data. This is the preferred method. I take it that there is a distinction for you between displaying the image when the link is clicked (a normal browser behavior) and downloading it to the default download location on the client computer. Convincing the browser to download rather than display is based on the MIME type associated with the file. A image/jpeg value is normally processed by the browser to be displayed in the browser. You could create a script which would get the file and supply the appropriate MIME type that would normally trigger a download on most browsers. On many Linux systems, a file called /etc/mime.types provides a list of MIME types used on that system. The Apache configuration files may also make special handling rules for particular MIME types. James