lundi 13 avril 2015

trying to post a form to a cgi script

I'm just new to haserl and so I have what I think is a pretty basic question. I have the following html page :



<form id="upload" method="POST" enctype="multipart/form-data" action"../cgi-bin/test">
<table>
<tr>
<td><input type=file name=uploadcsv id=uploadcsv></td>
<td><input name=import id=import type=submit value=Import></td>
</tr>
</table>
</form>


That html file lives in my /var/www folder.


The form displays correctly and using the F12 tools, I can see that the POST is being sent. Under "Params" tab in F12 in Firefox, I can see the contents of the csv file I selected using the file input control However the test logic I have in the cgi file is not being executed.


I have the following code in the cgi script called /var/www/cgi-bin/test:



#!/usr/bin/haserl --shell=lua --upload-target="/uploads"
<%
print('posted')
if FORM.upload then

print ("Status:200")
print ("Content-Type: text/html")
print (s)
else
print('something went wrong')
end

%>


Right now, nothing prints out on the page. I don't see any errors in F12 either.


Any suggestions would be appreciated. Thanks.


Aucun commentaire:

Enregistrer un commentaire