Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Downloading a file

  Asked By: Trupti    Date: May 01    Category: Java    Views: 555
  

I have a java servlet which allows a user to download the file. The file
is a txt file. If instead of saving the file I say open from location. A
message pops up

Cannot find C:\Documents And Setting.......\filename[2].txt file

Do you want to create a new file?
Yes/No/Cancel

If I click yes or no either ways the file is empty...

If I rename the file and make it as a .rtf file I manage to open it but txt
extension is creating a problem...

I have tried setting the content-type as 'application/text' and
'application/x-download'

and setting the header res.setHeader("Content-Disposition",
"attachment; filename=" + fileName);


Is there any way i can get around with this problem... ??

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Downloading a file Or get search suggestion and latest updates.




Tagged: