0
votes

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 ("inside the test")
else
    print('something went wrong')
end

%>

Right now, nothing prints out on the page. I don't see any errors in F12 either. I don't think it's loading / running my cgi script

What I've tried so far:

  1. I've changed the path in the action tag to "/cgi-bin/test"
  2. I've tried appending the extension ".cgi" to the action tag like so "/cgi-bin/test.cgi". Note: None of the scripts in cgi-bin have the extension though... and they are working fine.
  3. I am about to try putting the server side code in line into the html by setting the action to "action='#'". But I prefer that the final solution not have inline server side code.

Any suggestions would be appreciated. Thanks.

1

1 Answers

0
votes

I was missing the = sign in action tag.