This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.
I too need to download a file. I have used the approach stueccles has suggested and it works fine on firefox but not on internet explorer (v6)!
When I click on the to be downloaded file I get a the familiar 'save or open file' window. If I choose to save the file everything works fine. However, when I choose to open the file, I get error messages like:
- "This file could not be found" (for word files)
- "The compressed (zipped) folder is invalid or corrupted
- "Cannot find the file" (for txt files)
Do you check some login requirements before your download starts?
In ie, when you set the content disposition to be inline, the browser will do 2 requests, where the 2nd request will be sent without cookies. So if there is some authentication requirement that is saved in the cookies, the file will not be sent. Also make sure that the download url ends with the extension that IE expects and knows otherwise it will show the binary format in the browser without starting the application to handle the bytes. So my download urls always end with a specific parameter IE=pdf or something like that
During download my file got corrupted. After struggling for a long time I came to know that it is being compressed by the GZIP filter whichi I have in web.xml. I had my own filter. So I put a exclude list and included download URLs in the web.xml to exclude filter for file downloadings.