Assuming you use lighttpd, I could not get it to work either.
I use the package haserl now (http://haserl.sourceforge.net/) for my upload page.
I'm trying to use this cgi script (didn't attach html with forms...):
The problem is - nothing happens. I'm using lighttpd with mod-cgi (tryed fastcgi, but couldn't handle .cgi files).Code:#!/bin/sh use strict; use CGI; use CGI::Carp qw ( fatalsToBrowser ); use File::Basename; my $upload_filehandle = $query->upload("userfile"); $filename = $1; open ( UPLOADFILE, ">/upload/$filename" ) or die "$!"; binmode UPLOADFILE; while ( <$upload_filehandle> ) { print UPLOADFILE; } close UPLOADFILE;
I get this error.log entry when clicking "upload" button:
Any ideas?2009-08-24 23:17:51: (mod_cgi.c.1118) write() failed due to: Broken pipe
Assuming you use lighttpd, I could not get it to work either.
I use the package haserl now (http://haserl.sourceforge.net/) for my upload page.
good idea to use haserl.
But I get response "file uploads not allowed".
Then I echoed the HASERL_UPLOAD_LIMIT and it returns 0.
So I guess the first line of the script is not parsed correctly?
Code:#!/opt/bin/haserl --upload-limit=4096 --upload-dir="/ul" content-type: text/html <html><body> <% echo $HASERL_UPLOAD_LIMIT %> #returns 0 <% echo $HASERL_UPLOAD_DIR %> #returns /tmp <form action="<% echo -n $SCRIPT_NAME %>" method=POST enctype="multipart/form-data" > <input type=file name=uploadfile> <input type=submit value=GO> <br> <% if test -n "$FORM_uploadfile"; then %> <p> You uploaded a file named <b><% echo -n $FORM_uploadfile_name %></b>, and it was temporarily stored on the server as <i><% echo $FORM_uploadfile %></i>. The file was <% cat $FORM_uploadfile | wc -c %> bytes long.</p> <% rm -f $FORM_uploadfile %><p>Don.t worry, the file has just been deleted from the web server.</p> <% else %> You haven.t uploaded a file yet. <% fi %> </form> </body></html>
I have --upload-target instead of --upload-dir:
Code:#!/opt/bin/haserl --upload-limit=4096 --upload-target=/tmp
Something else must be wrong. Now I'm pretty sure it's lighttpd configuration.
Command line parameter (upload-limit) is just not passed over to haserl.
Could you perhaps show your lighttpd.conf file?
I've found somewhere same problem, but the solution was to use httpd. I don't want to do that.
thanks
There is nothing haserl specific in my conf file.
For mod_cgi there is only:
Did you check that the user that runs lighttpd has write permission for the upload dir?Code:$HTTP["url"] =~ "^/cgi-bin" { cgi.assign = ( "" => "" ) }
Thank you, that was it!
I had ....=> "/opt/bin/haserl"...
so it didn't take arguments from the first line of the script
i'll post instructions for the whole thing now