Send form data to CGI script
Send form data to CGI script
I have a server-side CGI script that receives form data from a client-side HTML form in order to upload a client-side file to the server. The server CGI code is infrastructure that I can't change, so suggestions to use a different mechanism aren't real useful. I would like to replace the client-side HTML code with CrossUI display elements and code. Is there an example or any guidance on how to do this?
Joe
Joe
Re: Send form data to CGI script
More specifically to my request above:
I have a server-side CGI script that receives file upload requests from a client-side html page. The html looks like this:
<html>
<head>
<title>Upload Form</title>
<body>
<h1>Upload Form</h1>
<form method="post" action="upload.pl" enctype="multipart/form-data">
<center>
Enter a file to upload: <input type="file" name="upfile"><br>
<input type="submit" name="button" value="Upload File">
</center>
</form>
"Upload.pl" is the name of the server-side script.
I want to integrate the client-side html functionality into my larger CrossUI application, using a nice CrossUI GUI and lavascript. What's the best way to approach this and how should the submit data be structured? A simple code example would be appreciated.
I have a server-side CGI script that receives file upload requests from a client-side html page. The html looks like this:
<html>
<head>
<title>Upload Form</title>
<body>
<h1>Upload Form</h1>
<form method="post" action="upload.pl" enctype="multipart/form-data">
<center>
Enter a file to upload: <input type="file" name="upfile"><br>
<input type="submit" name="button" value="Upload File">
</center>
</form>
"Upload.pl" is the name of the server-side script.
I want to integrate the client-side html functionality into my larger CrossUI application, using a nice CrossUI GUI and lavascript. What's the best way to approach this and how should the submit data be structured? A simple code example would be appreciated.
Re: Send form data to CGI script - 3rd request
Can someone from support please reply to this? I need to understand how to code a button event to simulate the above html file upload function.
Joe
Joe
Re: Send form data to CGI script
I saw that thread before. It doesn't seem to come to any conclusion...it just ends.
Re: Send form data to CGI script
Thanks. This might be helpful if I can get it to run
When I select "Open Code in CrossUI RAD" I get errors at lines 5 and 44, but it still seems to execute with no console error messages.
I tried to modify button code to reference my existing server GGI/Perl script (which will possibly also need mods), but the file source is coming across with "C:\fakepath" in the file spec (file.value). How do I set my desired source file path?
Also, how do I set the file combo's default directory? Can I filter this so it only displays files with a specific extension?
Thanks
Joe
When I select "Open Code in CrossUI RAD" I get errors at lines 5 and 44, but it still seems to execute with no console error messages.
I tried to modify button code to reference my existing server GGI/Perl script (which will possibly also need mods), but the file source is coming across with "C:\fakepath" in the file spec (file.value). How do I set my desired source file path?
Also, how do I set the file combo's default directory? Can I filter this so it only displays files with a specific extension?
Thanks
Joe
Re: Send form data to CGI script
1. The browser allow you select file via "browsers select file dialog" only, you cant set the file path to the Control via code.
2. The sandbox of browser doesn't allow you to set combo's (<input type=file> in html) default directory.
3. Those errors are "simicolon" issues, you can ignore those.
2. The sandbox of browser doesn't allow you to set combo's (<input type=file> in html) default directory.
3. Those errors are "simicolon" issues, you can ignore those.
Re: Send form data to CGI script
OK, I think I have those issues worked out, but I don't have PHP available on my server, so I need to figure out how to modify it to work with my existing CGI/Perl script, which works. Ignoring funky table formatting, the client HTML functionality looks like this:
File Upload
<br>
<br>
<tr>
<form method="post" action="$PROGNAME" enctype="multipart/form-data">
</tr>
<tr>
<input type="file" name="upfile"><br>
</tr>
<tr>
<br>
<br>
<input type="submit" name="button" value="Upload">
</tr>
</center>
</form>
File Upload
<br>
<br>
<tr>
<form method="post" action="$PROGNAME" enctype="multipart/form-data">
</tr>
<tr>
<input type="file" name="upfile"><br>
</tr>
<tr>
<br>
<br>
<input type="submit" name="button" value="Upload">
</tr>
</center>
</form>
Last edited by joedarock on Thu Aug 10, 2017 3:27 pm, edited 2 times in total.
Re: Send form data to CGI script
If you have a file to do the request, it is a 'post' action automatically.
And if you want to do it manually:
request(uri/*string*/, query/*object*/, onSuccess/*function*/, onFail/*function*/, threadid/*null*/, {method:"post"})
And if you want to do it manually:
request(uri/*string*/, query/*object*/, onSuccess/*function*/, onFail/*function*/, threadid/*null*/, {method:"post"})