On 21 Jan 2007, at 18:00:14, Mark Stickley wrote:

Hi guys,

I am trying to make a feature where a user can click a link to download an image. The trouble is of course that the image loads into the browser. Does anyone know of a way to force a download of an image rather than the behaviour I've been experiencing? I'd rather not have to include text instructing the user on how to right click etc as it kind of messes with the layout...


You can use the Content-Disposition header to tell the browser to save the file rather than displaying it:

Content-Disposition: attachment; filename="someImage.png"

although there are some issues with older versions of IE Win, as described at <http://www.hanselman.com/blog/ TheContentDispositionSagaControllingTheSuggestedFileNameInTheBrowsersSav eAsDialog.aspx>

There's a more detailed explanation of the process at
<http://www.boutell.com/newfaq/creating/forcedownload.html>

HTH,

Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/





*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to