|
Mike, A CGI program can generate any type of content but you have to set the HTTP headers correctly and correctly generate the content. Also, there's a content-disposition header that you can use to force the browser to display the save/open dialog and specify the file name. Here's an example of the headers I send when I generate a CSV file: Content-type: application/msexcel-comma Content-encoding: ebcdic Expires: Tues, 01 Jan 1980 00:00:00 GMT content-disposition: attachment; filename=upcoming editions list.csv If you translate the content to ASCII first, you don't need to set the Content-encoding header but this is the less programming work way to make sure the delivered content is readable. Matt -----Original Message----- From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Mike Cunningham Sent: Tuesday, March 14, 2006 11:05 PM To: Web Enabling the AS400 / iSeries Subject: [WEB400] using rpg cgi to send a .csv or .rtf file I have done some RPG CGI to sent html files but I would now like to send the user a .csv file that will open in Excel or a .rtf file that will open in Word or a .vcs file that will open in Outlook. Is it possible to use the same RPG CGI technique to do this (e.g. load a base file from the IFS and use the CGI commands to replace the variable data and then send the file like it was HTML) ? Or would I need to save the file back to the IFS in a directory that the Apache server can serve from and then do an HTML redirect to get he users browser pointed to that file ? In my case I want to be able to let a student click on a button on a web page and then convert the students class schedule into a .vcs file (already have that code) that will be sent immediately and present the student with the normal "Open" or "Save" prompt from their browser.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.