1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-03 08:07:17 -05:00

Added test for uploading big files.

the big_file.cgi calculates size and md5sum of sent file.
This commit is contained in:
Witold Filipczyk 2008-04-27 12:41:01 +02:00 committed by Witold Filipczyk
parent 4427f2b8b8
commit 10caf7a4bc
2 changed files with 29 additions and 0 deletions

20
test/cgi/big_file.cgi Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env python
import md5
import cgi
print "Content-Type: text/plain\r\n\r\n"
form = cgi.FieldStorage()
if form.has_key("file"):
plik = form["file"]
length = 0
if plik.file:
dig = md5.new()
while 1:
data = plik.file.read(1000000)
if not data:
break
length += len(data)
dig.update(data)
print "Size = %d" % length
print "MD5=" + dig.hexdigest()

9
test/cgi/big_file.html Normal file
View File

@ -0,0 +1,9 @@
<html>
<body>
<form name="a" method="POST" enctype="multipart/form-data"
action="big_file.cgi">
File:<input type="file" name="file" />
<input type="submit" value="Send" />
</form>
</body>
</html>