Netro
Netro

Reputation: 7297

Pyramid FileResponse changes name

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?

Upvotes: 1

Views: 692

Answers (2)

Georgi
Georgi

Reputation: 71

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.

Upvotes: 0

Netro
Netro

Reputation: 7297

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

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

Upvotes: 1

Related Questions