mirror of
https://github.com/rkd77/elinks.git
synced 2024-09-06 23:44:43 -04:00
Added test for uploading big files.
the big_file.cgi calculates size and md5sum of sent file.
This commit is contained in:
parent
4427f2b8b8
commit
10caf7a4bc
20
test/cgi/big_file.cgi
Executable file
20
test/cgi/big_file.cgi
Executable 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
9
test/cgi/big_file.html
Normal 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>
|
Loading…
Reference in New Issue
Block a user