• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with file's name in download dialog

 
Mike Himstead
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a minor problem with sending a file to the client. I have an action that gets an Excel file from a remote database and sends it to the browser using the following code:



The struts-config:


I (have to) use Struts 1.1. Sometimes the browser's download dialog doesn't show the correct filename but the action's name (searchProtocol) instead. Debugging assured that the FileData object is correctly filled and returns the proper name and the header's mime-type is correct as well. The files itselves are always okay/undamaged. It seems as if it somehow depends on the selected file because some files always show the correct names, others never.

Any ideas what can cause this?
[ February 08, 2008: Message edited by: Mike Himstead ]
 
Joe Ess
Bartender
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a drive-by comment about this line:

AvailableDoesntDoWhatYouThinkItDoes
 
Mike Himstead
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe,

thank you for your comment. Is there a mistake or typo in the FAQ? The line


doesn't seem to be correct. I guess what meant is:



Or am I wrong?
 
Joe Ess
Bartender
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are correct. I updated the FAQ.
I looked at the code I'm using to do the same task. It looks very much like yours, but is working correctly. Perhaps some of the file names you are coming up with aren't valid and the browser is falling back on the action name? What names are giving you trouble?
 
Mike Himstead
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
*slapsforehead*

The filenames contained a slash ("/") which can't be in a filename (at least on Windows platforms). Thank you for your input and have a nice weekend.
 
Joe Ess
Bartender
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic