Forum

file upload with http post error

alexong
9 January 2015, 10:46
Hello,

When i'm trying to upload a file with http post (if i use enctype=\"multipart/form-data\" in form), i'm getting a 500 Internal Server Error. Cgi script is not executed.
But if i remove the enctype from form then Cgi script is executed properly. (it returns an error like "file could not be uploaded" )
The file size is about 8mb. I set the maxupload size 15(mb) and also maxrequestsize 22000(kb) in my hiawatha.conf.

What can be the problem, do you have any suggestion?

Thank you.

Here is my http code part
.
.
/* HTTP header */
printf("Content-type: text/html\r\n");
printf("\r\n");
printf( "<form enctype=\"multipart/form-data\" name='phoneform' method='POST' action='cgi-bin/swupdate.cgi?typ=%s' onsubmit=\"return true;\">",szTyp);
printf("<input name=\"file\" type=\"file\" /> <input name=\"submit\" value=\"%s\" type=\"submit\" />",szString);
printf("</form>");
.
.


Here is my hiawatha.conf
# Hiawatha main configuration file
#


# GENERAL SETTINGS
#
ConnectionsTotal = 250
ConnectionsPerIP = 25
SystemLogfile = /ctesty/srv/var/log/system.log
GarbageLogfile = /ctest/srv/var/log/garbage.log


# BINDING SETTINGS
# A binding is where a client can connect to.
#
Binding {
BindingID = port3802
Port = 3802
MaxRequestSize = 22000
Interface = 0.0.0.0
TimeForRequest = 3,20
MaxUploadSize = 15
}


# COMMON GATEWAY INTERFACE (CGI) SETTINGS
# These settings can be used to run CGI applications.
#
CGIhandler = /ctest/srv/bin/ssi-cgi:shtml
CGIextension = cgi
TimeForCGI = 350

# DEFAULT WEBSITE
# It is wise to use your IP address as the hostname of the default website
# and give it a blank webpage. By doing so, automated webscanners won't find
# your possible vulnerable website.
#
Hostname = 127.0.0.1
WebsiteRoot = /ctest/srv/var/www
StartFile = index.shtml
AccessLogfile = /ctest/srv/var/log/access.log
ErrorLogfile = /ctest/srv/var/log/error.log
ExploitLogfile = /ctest/srv/var/log/exploit.log
ExecuteCGI = yes




Hiawatha version: 9.7
Operating System: Suse 12.2
Hugo Leisink
9 January 2015, 13:54
What does the error logfile say?
alexong
12 January 2015, 07:42
Actually nothing. All log files are empty (even system.log file)
I've deleted all log files then restarted the webserver, log files are successfully created but no information inside the files ("hiawatha webserver started" etc...)
Hugo Leisink
12 January 2015, 10:44
My guess is that the cause is somewhere in PHP or the script itself. I have no idea. It's hard to say from a distance.
This topic has been closed.