Wrox Home  
Search P2P Archive for: Go

  Return to Index  

html_code_clinic thread: Changing the name of a file to download


Message #1 by steve.owen@g... on Thu, 7 Mar 2002 16:48:50
The problem is solved.

For anyone else interested, it seems as if the following two lines do the 
job (it might be overkill, but these definitely work).

Response.Addheader "Content-Disposition","inline; filename=" & [filename]
Response.CacheControl = "public"

Cheers,
Steve


> My site features many megabytes of images that our clients can help 
> themselves to. Most of our clients run their own Web sites, and we 
> want them to take the images rather than link to them.
> 
> As such, I've got some ASP so that hyper-links to the images actually 
run 
> an ASP page which checks the user, logs the request and then writes the 
> image directly to the browser. That way the location of the image is 
never 
> revealed, and if the link is published, unauthorised people won't be 
able 
> to see the image.
> 
> For instance, http://www.gamespress.co.uk/showfile.asp?
> a=full&i=3257&f=Club+Footy+Nick+Wheelwright+and+girls%2Ejpg
> 
> This is working beautifully and I'm very happy with it. However, if 
> someone right clicks and chooses to Save Target As... the file prompt 
> always suggests the name showfile.jpg. How can I get the browser to 
> suggest the name of the file instead? I'm happy with using ASP to write 
> the filename to the right bit of HTML. I just don't know exactly where 
to 
> write it! I'm assuming it's a header setting somewhere, renaming 
> the 'page' visited, at least as far as the browser is concerned.
> 
> I hope that's enough info for you. And I'm grateful for any pointers.
> 
> Cheers,
> Steve

  Return to Index