Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread donwload a file
Wed, Aug 30 2017 3:16 PMPermanent Link

Ronald

Hi,
I am trying to download a file in a ewb-webserver module. I use this (it downloads a small .txt file):

Request.SendCustomContent(TempList.Text,'application/octet-stream',Format('attachment; filename="%s %s;"',[DateToStr(Date),'test.txt']));

The content is indeed sent back to the client (I can see it in the pagecontent), but the client does not respond with the dialog: "Do you want to save this file?" With IIS this always worked fine. What am I doing wrong?

Greetings,
Ronald
Wed, Aug 30 2017 3:25 PMPermanent Link

Ronald

Templist.Text is a TStringList with some text in it.
Thu, Aug 31 2017 1:06 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ronald,

<< I am trying to download a file in a ewb-webserver module. I use this (it downloads a small .txt file):

Request.SendCustomContent(TempList.Text,'application/octet-stream',Format('attachment; filename="%s %s;"',[DateToStr(Date),'test.txt']));

The content is indeed sent back to the client (I can see it in the pagecontent), but the client does not respond with the dialog: "Do you want to save this file?" With IIS this always worked fine. What am I doing wrong? >>

How are you requesting the content ? If you're using a TServerRequest in an EWB client application, then the browser won't automatically handle the response.  In order to do that, you have to allow the user to click on a link that initiates the download request to the web server.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Aug 31 2017 1:52 PMPermanent Link

Ronald

Tim Young [Elevate Software] wrote:

<How are you requesting the content ? If you're using a TServerRequest in an EWB client application, then the browser won't automatically handle the response.  In order to do that, you have to allow the user to click on a link that initiates the download request to the web server.>

Yes, it is a TServerRequest. I will change it and have it send back the url and let the browserclient respond with a little dialog where the user can click on a TLink.

Ronald
Image