Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get rid off browser naming conventions

 
tanu dua
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using a servlet to send an excel file to the browser with the specified name say abc.xls and the browser gives 3 options :
1) open
2) save
3) cancel.

Now when i click open , the browser opens the file in excel like abc[1].xls in IE (6 and 7) and abc-1.xls in Firefox which I dont want . Is there any way to change the append string i.e. [1].

Or do i have to do client side so have to do all the hard work ?

Thanks
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might be useful for you.
 
tanu dua
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rahul.

But I cudn't get what I want it . I am able to get the data in excel and I can open it , save it , so no issues are there except the name that browser uses to open the file .

When say browser gets request to open the file say abc.xsl it will open it like abc[1].xsl (IE 6 and 7) and abc-1(Firefox).This [1] or -1 I dont want in the filename when it is opened.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Content-Disposition header allows you to send the desired name of the file to the browser. There is an example of its use in the FAQ entry that Raul gave you.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought I saw that [1] only when there was already a copy of the file in browser cache, ie the 2nd time I opened it, maybe with the first copy still open. Or did I just guess wrong about what was going on?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic