Hi I have a php test script which generates ascii text data - .csv format. I know on a proper server you can set the headers to be of a text format, so when you executed the script it offers the data as a downloadable file rather than show it on the browser, can something be done with exeoutput using _heopenit ? basically was hoping to add a link on a page to something like download.php, which generated the data with text headers, and would allow the user to download the file to their pc. Is this possible ? Any help would be grateful. I have a full license of the software.
To offer a downloadable file to the customer, you should work with HEScript:
function SaveFileDialog(const aTitle, aFilename, aDefaultExt, aFilter, aInitialDir: String): String;
It lets you open a save dialog box and returns the full path to the file the user wants to create. Then with PHP’s standard file functions, use the path to create the file, store data, etc…
For a working sample with full source code, see http://www.exeoutput.com/samples.php#PDF
Thanks for that - very helpful. But I assume you cannot do direct link downloading as you can on a server ?
if i had a php file download.php for example, and it contained the following…<?php $string = "abc,123"; $filename = "example-". date("Y") .".csv"; header ('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header ('Content-Type: application/octet-stream'); header ('Content-Length: ' . strlen($string)); header ("Content-Disposition: attachment; filename=\"$filename\""); echo($string); ?>
If I ran that server side it would offer a file example-2012.csv as a downloadable file (despite referencing a script download.php), which could be saved as a normal file to hard disk or alternatively open up on users default text editor. I assume this isn’t possible with exeoutput - not sure if a web server would be necessary as only declaring the output type via the headers as a file ? I guess it would be easier just to save the file locally as you say by allowing the user to specify a path via hescript.
An application made with ExeOutput does not work exactly like a webserver. Maybe I’ll revisit the direct download later.
Thanks for the feedback, the method earlier highlighted worked fine. To be frank, direct downloading isn’t normal in executable programs, so using a save function is more in keeping with standard programming than web based programming, so I stand corrected.