I am trying to add import and export function to a PHPexe desktop App I am building. I was wondering if anyone has a good example of how to use HEScripting to allow a user to click a button that selects a file that upon clicking another submit button can be read by the script as importing data.
On the other side an app that on export provides a dialog that allows a user to select the filename and location of where an output file would be saved and how to then send the new file header info to the browser to save the data. I have done this a few times in a Server environment where you can use UPLOAD File form elements, but I am not sure how to approach this with PHPEXE. If someone had a demo, that would be awesome.
Sure, you can a working demo in the main demo file:
But check also the source of this sample (HEScript save dialog box invoked by PHP to let user select a file to save):
Cool the Samples are very helpful. For the Save File Sample, how could I extend this example to save to a location that the user selected instead of saving to the default appdata folder?
The sample does exactly what you want.
That is a great example. Looking at the HE Script the following code is responsible for opening the Save As Fine Name Dialog:
function SaveDlgFile: String;
// Asks for filename
Result := SaveFileDialog("Save Text As", "*.pdf", "*.pdf", "PDF Files (*.pdf)|*.pdf|All files (*.*)|*.*", "");
// Returns blank string if user cancels the dialog.
The problem for me is that in the example it is attached to a submit button so the form submits right away. I need to capture the filename and location in memory or a hidden element so that when another button is clicked (The actual Submit Button) after the user has made other changes/selections the file that is being created saves. So the question is, how can I capture the save file location without submitting the form immediately.