1

I am using pyramid.response.FileResponse to serve files. At browser file name changes automatically to some random name. For e.g, file I want to serve is abc.zip but, at client it prompts to store as 3PE01Sf_.zip.zip. How to avoid this?

Netro
  • 7,119
  • 6
  • 40
  • 58
  • possible duplicate of [How to set file name in response](http://stackoverflow.com/questions/9991292/how-to-set-file-name-in-response) – X-Istence Mar 01 '15 at 06:09

2 Answers2

1

I got another question on similar line. it says use,

response.content_disposition = 'attachment; filename="my_filename.txt"'

Community
  • 1
  • 1
Netro
  • 7,119
  • 6
  • 40
  • 58
0

The name of the viewed file using a browser will depend on the route. If you look at the example in the doc the route points to '/test.jpg' but you are actually serving 'groundhog1.jpg'.

Alternatively depending on your source code, there maybe some library which generates the name of your dynamically created file, for example zip of PDF.

Georgi
  • 71
  • 4