It's not a secret anymore!
The moose likes Servlets and the fly likes HTTP Header question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Servlets
Reply locked New topic
Author

HTTP Header question

Shane Burgel
Ranch Hand

Joined: Sep 09, 2003
Posts: 47
Is there a header that can specify the file name?

I have a file with the following headers:

Content-Type=application/download
Content-Disposition=attachment

but I also want to specify the filename dynamically for the file when it is downloaded so I need a header that I can use to set the file name.

Thanks for your help
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Shane!.. This is servlet realted question, i'm moving this to servlet forum.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Try "Content-disposition: attachment; filename=MyFile.txt"


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Shane Burgel
Ranch Hand

Joined: Sep 09, 2003
Posts: 47
Thanks that worked but that begs another question. Is there a way to specify the download location for the file? Is there a way I can specify a header to say that the default download directory should be say C:\Temp ?
[ May 13, 2004: Message edited by: Shane Burgel ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

To prevent duplicate conversations, this thread is continued here.

I'll close this copy.
Dave.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: HTTP Header question
 
Similar Threads
Http Header Question #2
download link in jsp ?
File Extenssion not showing in Mozilla
Specify the filename of a dynamically generated image?
urgently needed help