How to set up a exo_return_hescriptcom call in a form or link

Does anybody have a code example of how to replace a standard HTML form input type=‘file’ … with exo_return_hescriptcom(“UserMain.OpenDlgFile”, “Error”); I looked everywhere and could not find an example. I want the user to click on a link or button to get a local file. Probably a simple to do. I’m just stuck. Thanks

Hi,

If I understood you correctly, you don’t want the user to click on the file button provided by the HTML INPUT/FILE element, instead you want the user to click a link and achieve the same thing.

You could use Javascript to fire the click event on the HTML input file button.

Normally I would go looking for file upload Javascript/php type solution, many about, most provide this and a lot more, just google it.

Hope that helps.
Joe

I would like to use the INPUT/FILE element, but once the PHP code is compiled, it no longer works. Assume because of this: http://www.exeoutput.com/help/choosingfilesupload. So how do you still use INPUT/FILE element when using ExeOutput for local file retrieval?

Why do you need an INPUT/FILE field since your user can immediately select the file he wants, and you get the full path to the selected file? You have two samples on http://www.exeoutput.com/help/choosingfilesupload

I know I can use the example you provided:

echo “Asking for filename…
”;
// Executes HEScript to call the system dialog “Open”…
$filename = exo_return_hescriptcom(“UserMain.OpenDlgFile”, “Error”);
// The $filename variable contains the full path to the file selected by the user. It can be passed to fopen for instance.
if (empty($filename))
{
echo “You have not selected any file. Operation canceled
”;
return;
}

But how to make this call within an HTML form if not using INPUT/FILE? I want the user to see a form before requesting the files (the user enters four filenames and a few other form options before the data is processed). I’m sure there’s a simple answer. I’m having a brain freeze. Hope I’m making sense???

Instead of using PHP, you can also use JavaScript to invoke UserMain.OpenDlgFile. Your JS code could set the value of the different file fields from the result of UserMain.OpenDlgFile. See http://www.exeoutput.com/help/callscript

I previously reviewed that link but couldn’t get it to do what I want. I guess I’m not explaining this well enough. Are there code examples to do exactly what a form INPUT/FILE does to work with ExeOutput to get a local file?

Just asking for a little help before I purchase the product. Is that too much to ask?

Hi Webguy22,

Not sure where you are having problems with this.

If you look at the PHP manual,
http://php.net/manual/en/features.file-upload.post-method.php

Copy the example code provided into files in your ExeOutput project, it works;

I tried this same example out myself, I created an index.php and inserted the HTML from the sample above, and created a second file called it “upload.php” and inserted the php sample code in that file, adjusted paths etc.

Saved my project, built it, works a treat, hope this helps.

Regards
Joe

INPUT/FILE and UPLOAD are now handled correctly in ExeOutput 2. You can try the Beta if you want (just email me).

Joe, thank you. That’s what I was looking for, but it the compiled exe file was still failing to read the file. It does work with ExeOutput2.