Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Download the .lzh file with prompting file save dialog

 
vinoth khanna
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am trying to develop a jsp which is used to download a .lzh compressed file,and that gives me probs..
when i uncheck [Ask before opening this type of file - option] in the "file download" dialog prompt(open - save dialog box),
next time the file opens directly,and that is what i dont need,i need it to prompt it again.

I tried even to read and write it using servlet output stream,but unfortunately .lzh file cannot be read and written properly by streams like these.

Any ideas !

Thanx ,
Vinod
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set the content type to something that the browser won't recognize.

You may even want to add some random chars to the content type so subsequent hits will always be unrecongnized.

You'll also want to set the Content-Disposition header to give the downloaded file a name.

[ January 05, 2005: Message edited by: Ben Souther ]
 
vinoth khanna
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx for ur idea! Even though I have file type recognized..
I had given file name like :

And still..
if i uncheck the option in open-save dialog ,i get opened directly by the default application..
so even though i randomly specify the mime type i get it opened directly..
It recognizes by file type it seems..

so how can i..

Regards,
Vinod
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens if you change the file extension?
filename=SI_MANUAL_06.lzh.xxx
 
vinoth khanna
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya I tried it ,it didn't work..if i change
sinece it just the file name to be displayed..it did not take it...

any more...
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wait:
I tried even to read and write it using servlet output stream,but unfortunately .lzh file cannot be read and written properly by streams like these.


Just noticed that...

You mean your not streaming it?
How are you sending it to the client? If you're not streaming it, how can you be setting the content-type or content-disposition?
 
vinoth khanna
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya i ma streaming it...no doubt
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic