Send form data to CGI script

Develop and Deploy Cross-Browser Web Apps .

Send form data to CGI script

Postby joedarock » Fri Aug 04, 2017 12:51 pm

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
joedarock
 
Posts: 159
Joined: Thu Nov 19, 2015 8:39 pm

Re: Send form data to CGI script

Postby joedarock » Tue Aug 08, 2017 4:41 pm

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.
joedarock
 
Posts: 159
Joined: Thu Nov 19, 2015 8:39 pm

Re: Send form data to CGI script - 3rd request

Postby joedarock » Wed Aug 09, 2017 12:14 pm

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
joedarock
 
Posts: 159
Joined: Thu Nov 19, 2015 8:39 pm

Re: Send form data to CGI script

Postby support » Wed Aug 09, 2017 2:42 pm

Please read this one first:

file-upload-iajax-t329.html?hilit=upload
support
 
Posts: 343
Joined: Sat Apr 27, 2013 9:22 am

Re: Send form data to CGI script

Postby joedarock » Wed Aug 09, 2017 3:18 pm

I saw that thread before. It doesn't seem to come to any conclusion...it just ends.
joedarock
 
Posts: 159
Joined: Thu Nov 19, 2015 8:39 pm

Re: Send form data to CGI script

Postby support » Thu Aug 10, 2017 12:56 am

support
 
Posts: 343
Joined: Sat Apr 27, 2013 9:22 am

Re: Send form data to CGI script

Postby joedarock » Thu Aug 10, 2017 11:46 am

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
joedarock
 
Posts: 159
Joined: Thu Nov 19, 2015 8:39 pm

Re: Send form data to CGI script

Postby support » Thu Aug 10, 2017 12:18 pm

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.
support
 
Posts: 343
Joined: Sat Apr 27, 2013 9:22 am

Re: Send form data to CGI script

Postby joedarock » Thu Aug 10, 2017 2:20 pm

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>
Last edited by joedarock on Thu Aug 10, 2017 3:27 pm, edited 2 times in total.
joedarock
 
Posts: 159
Joined: Thu Nov 19, 2015 8:39 pm

Re: Send form data to CGI script

Postby support » Thu Aug 10, 2017 2:53 pm

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"})
support
 
Posts: 343
Joined: Sat Apr 27, 2013 9:22 am

Next

Return to CrossUI for Web Apps

Who is online

Users browsing this forum: No registered users and 1 guest

cron