View previous topic :: View next topic |
Author |
Message |
photobank -
Joined: 27 Apr 2004 Posts: 9 Location: thailand
|
Posted: Tue Apr 27, 2004 4:32 am Post subject: Save As.. dialog for jpg |
|
|
Much appreciate if you could help me to figure out an HTTP header to force a browser into louching the usual "Save as.." dialog rather then open jpg files.
I have read ContenType could work somehow, but I do not know how to do it in practice.
thank you in advance. _________________ alberto |
|
Back to top |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Tue Apr 27, 2004 4:34 am Post subject: |
|
|
I don't know if that's possible; however I do know a commonly used practice is to put images and other files that won't download into ZIP archives.
Maybe try that. _________________ Bienvenidos! |
|
Back to top |
 |
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Tue Apr 27, 2004 4:47 pm Post subject: Re: Save As.. dialog for jpg |
|
|
photobank,
Try this small PHP script:
Code: |
<?
$file = "c:\\images\\img1.jpg";
header ("Content-type: octet/stream");
header ("Content-disposition: attachment; filename=".basename($file).";");
header("Content-Length: ".filesize($file));
readfile($file);
?>
|
The value of $file is the only paramter in this script that will force the download dialog. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Tue Apr 27, 2004 5:33 pm Post subject: |
|
|
Aprelium , I thank you for this !
My Anti-leech script is now going public !
Edit: I used your script but the zip file
is named .php when downloaded , weird! |
|
Back to top |
|
 |
|