t.t
September 21, 2021, 3:32pm
1
I’m trying to download a file via postman (send and download) but the filename comes as “response” and not with the original filename.
I’ve tried using
|> put_resp_header("content-disposition", "attachment; filename=\"#{file_name}\"")
but it doesn’t work
in a different setting, I managed using
conn
|> merge_resp_headers(content.headers)
|> resp(200, content.body)
to get the original name and file type but it’s not working with what I have now.
what could be preventing me to get the original filename?
Can you try downloading via a browser to eliminate the possibility of it being a postmane issue?
t.t
September 22, 2021, 1:24pm
3
i’m only getting “response.png” as a return. I’ve asked for the developers to return the name of the file in the headers and on their side is looking like
"Content-Disposition" - form-data; filename="nameOfTheFile.png"
then I tried both:
conn
|> put_resp_header("content-disposition", "attachment; filename=#{filename}")
|> resp(200, content)
conn
|> put_resp_header("content-disposition", "form-data; filename=#{filename}")
|> resp(200, content)
but they aren’t working as well
t.t
September 22, 2021, 1:26pm
4
the only time where the file shows to download is when I use:
conn
|> resp(200, content)
but with the name “response.png”. anything else that I’ve tried is returning an error.