[CGI] Re: downloading files with CGI
[1/1] from: SunandaDH::aol::com at: 20-Nov-2003 2:17
> How do I use REBOL to write a CGI script > that builds a page with a download link?
Simply version: you just need a href to the file that you want downloaded. Take a look at the source of: http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-librarian.r The "click here to download the alpha version" is simply a link to the file that will be downloaded. This may not be what you want, and it can cause problems with browsers have trouble with downloading files that contain HTML. (That may be because the server or browser is sending/assuming a content-type: text/html). The Script Library also uses another method (I've been experimenting with various things, and the experiments are not at an end) to download a file that may not exist until you click the link. Take a look at: http://www.rebol.org/cgi-bin/cgiwrap/rebol/documentation.r?script=patch-ftp-226-handling.r That has links to " Download documentation as: [HTML] or [editable]". Those files probably don't exist until you click the link. The link is to a program. That program creates the file and then sends a HTTP redirect to point your browser at the file it has created: print join "Location: " http://www.rebol.org/library/docs-download/patch-ftp-226-handling.r print "^/" ;; newline to end HTTP headers Sunanda.