Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

Търсене в помощните статии

Избягвайте измамите при поддръжката. Никога няма да ви помолим да се обадите или изпратите SMS на телефонен номер или да споделите лична информация. Моля, докладвайте подозрителна активност на "Докладване за злоупотреба".

Learn More

Downloading a pdf from firefox browser saves without the file extension

  • 2 отговора
  • 2 имат този проблем
  • 1 изглед
  • Последен отговор от kvmc09302012

more options

I am trying to download a pdf file from a web application and I am using firefox browser. When the file is downloaded, it doesn't have any extension. I have set the content type and content disposition in the back end java code as shown below.

response.setHeader("Content-Type", "application/pdf");
 response.setHeader("Content-Disposition", "attachment; filename=\"" + myfile + "\".pdf");

I am trying to download from a firefox browser in andriod phone(Samsung Note). The behaviour obsorved in desktop firefox also.

Thanks.

I am trying to download a pdf file from a web application and I am using firefox browser. When the file is downloaded, it doesn't have any extension. I have set the content type and content disposition in the back end java code as shown below. response.setHeader("Content-Type", "application/pdf"); response.setHeader("Content-Disposition", "attachment; filename=\"" + myfile + "\".pdf"); I am trying to download from a firefox browser in andriod phone(Samsung Note). The behaviour obsorved in desktop firefox also. Thanks.

Избрано решение

Hmm, I don't read Java, but with my JavaScript hat on, this seems to close the quoted filename string before the .pdf extension:

kvmc09302012 said

response.setHeader("Content-Disposition", "attachment; filename=\"" + myfile + "\".pdf");

So if myfile = proposal, you'd get

attachment; filename="proposal".pdf

What about moving that to the end:

response.setHeader("Content-Disposition", "attachment; filename=\"" + myfile + ".pdf\"");

Sorry if Firefox is a bit pickier about such things than other browsers!

Прочетете този отговор в контекста 👍 1

Всички отговори (2)

more options

Избрано решение

Hmm, I don't read Java, but with my JavaScript hat on, this seems to close the quoted filename string before the .pdf extension:

kvmc09302012 said

response.setHeader("Content-Disposition", "attachment; filename=\"" + myfile + "\".pdf");

So if myfile = proposal, you'd get

attachment; filename="proposal".pdf

What about moving that to the end:

response.setHeader("Content-Disposition", "attachment; filename=\"" + myfile + ".pdf\"");

Sorry if Firefox is a bit pickier about such things than other browsers!

more options

Yes, that solved the problem. Appreciate the help.