I'm returning an image to my webpage with a pyramid fileResponse
like this:
response = FileResponse(newPath)
response.content_disposition = f'attachment; filename="{newImage}"'
return response
I get the file back fine, but i can't figure out how to add more parameters to this. I want to return the file and the name of the file. I've looked at questions like How to set file name in response, but i can't seem to make this work.
this answer seems to suggest that i wouldn't even want to use Content-Disposition
, because i am displaying it, but i can't find any other ways to add a parameter.
That said, you can use the Content-Disposition header to specify that you want the browser to download the file rather than display it, and you can also suggest a filename for the file to use for that file. It looks like this:
How can i add another parameter to my fileResponse
?