Consultor Eletrônico



Kbase P25129: How to have a client download a file from a webserver.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   25/11/2003
Status: Unverified

GOAL:

How to have a client download a file from a webserver.

FIX:

The following is some sample syntax for this process. It must be in the <HEAD> of your HTML document. I HIGHLY suggest using a seperate directory to contain files for download so that a user does not download secure information.


<SCRIPT LANGUAGE="SpeedScript">
Def var cDownloadFileName as char init "textfile".
def var databuffer as c.

PROCEDURE output-header:
RUN OutputHttpHeader IN web-utilities-hdl ("content-disposition","inline~; filename=/downloadfiles/" + cDownloadFileName).
output-content-type ("application/download").
END Procedure.


INPUT FROM value(cDownloadFileName + ".TXT").
DO WHILE TRUE:
IMPORT UNFORMATTED databuffer.
put {&webstream} control databuffer.
End.

</SCRIPT>