Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

downloadable JPEGS... is this POSSIBLE???

Status
Not open for further replies.

sumilsay

Technical User
Feb 12, 2003
69
0
0
CA
sounds simple right? well, i know that a user can download a jpeg by simply right-clicking. but is it possible to open a download box when a link is clicked?

for example, pdf's, tiff's, and other large files sometimes open up a download box automatically. is there anyway to do this with a link to a jpeg file?

thanks,
me.
 
Sure, the same way you wouljd do it with any file:

Code:
Download this <a href=&quot;GodzillaWearingTutu.jpg&quot;>very naughty picture of Godzilla!</a> before your mother finds out!

Cheers,


[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
hi EdwardMartinIII, but that way, it will only open the picture in the explorer window, rather than having the save box open. i want the user to be able to download the pic right away, rather than the pic opening up.

thanks,
me.
 
Oh.

Throw it in a ZIP file. Or change the extension. If the browser recognizes the extension, it'll treat it accordingly.

PDF, TIF and other files open a save dialogue not because of their size, but because the browser doesn't recognize them, so rather than trying to display them as best it can, it just figures you want to download 'em.

Browsers usually recognize and attempt to display HTML, HTM, JPG, GIF, and TXT files. Sometimes they recognize PDF if the browser and ACrobat play well with each other. Sometimes they'll recognize other extensions, such as HTA, EXE, BAT, SCR. It is this questionable tendency that's allowed a certain vulnerability to easy-to-write malicious scripts.

Cheers,


[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
awsome! very interesting and educational.

thanks bro!

peace.
 
If you are using apache, it is conceivable that you could set the browser clients to display .JPG files in HTML pages and download .JPEG files. The httpd.conf file should detail how to do this. The config file for the apache server is how the server recognizes that ZIP and EXE files should be sent as file downloads rather than part of an HTML page. The same tweaking could be done for any other type of file (in this case, JPEGs).

You may also investigate using a scripting language like PHP or ASP to control the headers for the file transfer, which tells the browser whether it should display a file in an HTML page or download a file with a 'save as...' dialog box.

- - picklefish - -
 
RISTMO, that would be awsome if you can do that.

thanks so much.


me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top