Open Danteba opened 1 year ago
Hello
In the function StreamFile it is not possible to set the filename of the streamed file.
So, if the streamed file is downloaded, it do not have a properly name.
It can be fixed simply adding a header with "Content-Disposition: attachment; filename=myfile.pdf", or similar.
I think that you can add something like
return streamFile("/foo.txt") .withStatus(200) .withMime("application/pdf") .withDisposition("attachment; filename=myfile.pdf")
Or simply adding .withHeaders() to this function:
return streamFile("/foo.txt") .withStatus(200) .withMime("application/pdf") .withHeaders({"Content-Disposition":"attachment; filename=myfile.pdf"})
In the meantime, I just added this to my code: <cfheader name="Content-Disposition" value="attachment; filename=myfile.pdf" > before "return StreamFile(...)"
<cfheader name="Content-Disposition" value="attachment; filename=myfile.pdf" >
And the streamed file can be downloaded with the suggested name.
Thank you
Hello
In the function StreamFile it is not possible to set the filename of the streamed file.
So, if the streamed file is downloaded, it do not have a properly name.
It can be fixed simply adding a header with "Content-Disposition: attachment; filename=myfile.pdf", or similar.
I think that you can add something like
Or simply adding .withHeaders() to this function:
In the meantime, I just added this to my code:
<cfheader name="Content-Disposition" value="attachment; filename=myfile.pdf" >
before "return StreamFile(...)"And the streamed file can be downloaded with the suggested name.
Thank you