05-20-2007 06:50 AM
Hello,
I use LabView 8.2 including the Internet Toolkit. To process form data I use the G WebServer.
In the context of CGI-programming I have the following problem:
Using a html-form (code see below) I want to send two numbers and a *.txt-file to a CGI VI (cgi-test.vi). Afterwards this vi sends the sum of the two numbers and the content of the *.txt-file back to the user.
The html-code of the form looks like as follows:
<head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body bgcolor="#FFFFFF" text="#000000"><p><font size="5"><b>CGI-Test - addition of two numbers</b></font></p><hr><p>This form adds two numbers and displays the sum as well as the content of the uploaded *.txt-file.</p><form name="form1" method="post" action="/cgi-bin/cgi-test" enctype="multipart/form-data"> <p> Number 1 <input type="text" name="n1"> </p> <p>Number 2 <input type="text" name="n2"> </p> <p> <input type="file" name="f1"> </p> <p> <input type="submit" name="submit" value="submit"> <input type="reset" name="reset" value="reset"> </p></form><p> </p></body></html>
Pressing the submit button evokes the transmission of the data to cgi-test.vi. Theoretically afterwards the keyed array has to be disaggregated in its single components, facilitating further processing of the submitted data (i.e. calculation of the sum of the two numbers as well as displaying the content of the *.txt-file). However I get the following result:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Draft//EN"><HTML><!-- Constructed with the G Web Server -->
<HEAD><TITLE>CGI-Test</TITLE></HEAD>
<BODY >Summe:0File content:
</BODY></HTML>
I don't know why the three submitted data (n1, n2, f1) obviously cannot be break down and why the further processing leads to a inconvenient result.
My questions are:
1. How can I break down the three data so that I can call them independently from each other?
Why doesn't the "keyed array index.vi" work correctly?2. Is there a mistake in my html-form?
3. Are there some cgi-template-vi's on the web, which process uploaded file content?
The cgi-test.vi looks like as follows:
05-21-2007 04:12 AM
05-21-2007 04:45 AM
05-21-2007 09:49 AM
05-21-2007 11:38 AM - edited 05-21-2007 11:38 AM
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><font size="5"><b>CGI-Test - addition of two numbers</b></font></p>
<hr>
<p>This form adds two numbers and displays the sum as well as the content of the uploaded *.txt-file.</p>
<form name="form1" method="post" action="/cgi-bin/cgi-test_10.vi" enctype="multipart/form-data">
<p> Number 1
<input type="text" name="n1">
</p>
<p>Number 2
<input type="text" name="n2">
</p>
<p>
<input type="file" name="f1">
</p>
<p>
<input type="submit" name="submit" value="submit">
<input type="reset" name="reset" value="reset">
</p>
</form>
<p> </p>
</body>
</html>
Message Edited by ulrichmayer on 05-21-2007 11:39 AM
Message Edited by ulrichmayer on 05-21-2007 11:40 AM
05-22-2007 10:27 AM
05-22-2007 03:16 PM
05-23-2007 10:19 AM