• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

File download - file name doesnot appear

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

We are using a ServletOutputStream to send a file to the user for download. The code is as below. It reads a file off the disk (C:\abc.zip) and streams it to the user for download. The name of the downloaded file should have been abc.zip.






The file name was abc.zip untill we used IE6 SP2. When we upgraded to IE6 SP3, the filename of the file downloaded changed "reportGeneration.zip" (which I think it gets from the action name). I have no clue why this is happening. I have tried hard coding the filename - but it didnt work. I tried changing the contentType too - no use.

Any ideas ?

Thanks,
Midhun

P.S. I know I should upgrade my browser. But this is our firm uses.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't say for sure, but I'm a little concerned by that "sos.flush();" Once you start writing data to the output stream, you can no longer set any headers, so it's possible that's why your filename is getting lost.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Midhun Agnihotram wrote:"C:\abc.zip"


\ is an escape character in Java Strings. The above is not the String representation of C:\abc.zip, but of C: followed by character \a followed by bc.zip. As it is, \a is not even a valid character so your code shouldn't even compile. So my request is, please PostRealCode.
 
Midhun Agnihotram
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Rob, I am apologize for that piece of code. That filename is actually generated at runtime. To simplify, I had put it that way.

Ernest, that thing worked after I moved sos.flush() after sos.write(data);

Thanks,
Midhun.

 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Midhun Agnihotram wrote:
Ernest, that thing worked after I moved sos.flush() after sos.write(data);



Great! Thanks for letting us know!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic