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:
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 ]
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?
Joined: Apr 12, 2006
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.