Dear Friends
I have an image with live live address of that image,
I want to download that image when i click on any link for that image, but the problem is that when i click on the link the image has been opened in another window.
kindly helps me for that when i clicked on any link then image will be download on my specific location
Waiting for your replies
Thanks
Image downlaoding Code
Moderator: General Moderators
Re: Image downlaoding Code
file_get_contents() to read the image and header() to set the mime type
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
-
habib009pk
- Forum Commoner
- Posts: 43
- Joined: Sun Jul 05, 2009 11:28 pm
Re: Image downlaoding Code
I got the result from this code Thanks
//Get the Query String
$file=$_SERVER["QUERY_STRING"];
//Get the values from Query String
$bidno=$_GET['bid'];
$picno=$_GET['npic'];
$auct_id=$_GET['auct_id'];
//Cut five Character of Query String
$file=substr($file, 5, 2000);
$filename=$auct_id."_".$bidno."_".$picno.".jpg";
//Display the Save Box
header("Content-Type: application/octet-stream;");
header("Content-Transfer-Encoding: binary");
header('Content-Disposition: attachment; filename='.$filename.'');
readfile($file);
//Get the Query String
$file=$_SERVER["QUERY_STRING"];
//Get the values from Query String
$bidno=$_GET['bid'];
$picno=$_GET['npic'];
$auct_id=$_GET['auct_id'];
//Cut five Character of Query String
$file=substr($file, 5, 2000);
$filename=$auct_id."_".$bidno."_".$picno.".jpg";
//Display the Save Box
header("Content-Type: application/octet-stream;");
header("Content-Transfer-Encoding: binary");
header('Content-Disposition: attachment; filename='.$filename.'');
readfile($file);