Save As Dialog with href in html
Posted: Mon Apr 02, 2007 7:21 am
feyd | Please use
but then on clicking the link, the saveas dialog does come but with some download.php page as file and that contains some error messages.
Could anybody help me out figuring out this problem.
A tested/tried code-snipped example shall be highly appreciated.
thanks.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi All,
I have a very small problem on which i have spent some reasonable amount of time, but still couldn't able to find out the solution
The problem is that i have an html page on which there is an href link (infact 4) that contains a url to a file (.csv) located on some different host/domain. Now what i want is that when ever user clicks to this link, the file *SaveAs* doalog popup should appear and ask the user to save a file. On FireFox, the href defualt behaviour is doing what i needed, but when i use IE6, the .csv file direclty opens itself into the browser.
I have tried the following:Code: Select all
$url = $_GET[file];
$mm_type="application/msexcel";
header("Cache-Control: public, must-revalidate");
header("Pragma: hack");
header("Content-Type: " . $mm_type);
header("Content-Length: " .(string)(filesize($url)) );
header('Content-Disposition: attachment; filename="'.basename($url).'"');
header("Content-Transfer-Encoding: binary\n");
$fp = fopen($url, 'rb');
$buffer = fread($fp, filesize($url));
fclose ($fp);
print $buffer;Could anybody help me out figuring out this problem.
A tested/tried code-snipped example shall be highly appreciated.
thanks.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]