Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes Suggested File Name Problem in Downloading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Suggested File Name Problem in Downloading" Watch "Suggested File Name Problem in Downloading" New topic
Author

Suggested File Name Problem in Downloading

amit sharma
Ranch Hand

Joined: Jul 19, 2006
Posts: 129
In my application client can download reports in excel .I also suggest filename to client based on the parameter like fromdate to todate .My code is
response.setHeader("Content-Disposition","attachment;filename="+reportname);
When the reportname is small it gives the correct filename but when it is large it show something CAG... .How i give the correct filename .
Thanks
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
What is CAG?
How do you generate the filename.Probably the filename is too big for the OS.Your host OS might not be supporting that long filename.What exact exception/error you are getting.


Rahul Bhattacharjee
LinkedIn - Blog
amit sharma
Ranch Hand

Joined: Jul 19, 2006
Posts: 129
I not getting any exception file is downloaded properly .CAG..( it contains some more character) is suggested filename when filename is long .Is it possible to reslve this issue.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Did you try to enclose the filename with double quotations ?
How long is your filename exactly ?


[My Blog]
All roads lead to JavaRanch
amit sharma
Ranch Hand

Joined: Jul 19, 2006
Posts: 129
I want the file name something like this TravelledPathReport_20 Sep 2006 to 21 Sep 2006.
.I enclose the filename with double qoutes but it not works .I use Windows Xp.
Thanks
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
make the name seperated by underscore like

TravelledPathReport_20_Sep_2006_to_21_Sep_2006.txt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Suggested File Name Problem in Downloading