Stream define default name - WeOnlyDo Discussion board

Stream define default name (wodWebServer / wodWebServer.NET)

by Yves, Thursday, January 13, 2022, 11:47 (1055 days ago)

Hi,

Is there a way to define the default name for a downloaded file.

response.stream = fs

This works like expected! But all files are named file.pdf or downloadfile.pdf.
thanks for any help

Stream define default name

by wodSupport, Thursday, January 13, 2022, 11:49 (1055 days ago) @ Yves

Hi.

Why are then named 'file.pdf'? Where does PDF come from?

Jasmine

Stream define default name

by Yves, Thursday, January 13, 2022, 13:45 (1055 days ago) @ wodSupport

The file is located on the local server where our service (with your component) is running.
example C:\xxxx\Solinf.pdf


Open as a filestream and sent to the client

Dim fs As New System.IO.FileStream(a, System.IO.FileMode.Open)
Args.Response.Stream = fs

On the client side the file is always downloaded as download.pdf (in Microsoft Edge) or pdf.pdf in Firefox

Stream define default name

by wodSupport, Thursday, January 13, 2022, 15:20 (1055 days ago) @ Yves

Hi.

You can try with content-disposition header in reply, as explained here:

Stackoverflow

But I personally have never tried it.

Regards,
Jasmine