2020-01-03 14:19:48 -05:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import hashlib
|
2008-04-27 06:41:01 -04:00
|
|
|
import cgi
|
|
|
|
|
2020-01-03 14:19:48 -05:00
|
|
|
print("Content-Type: text/plain\r\n")
|
2008-04-27 06:41:01 -04:00
|
|
|
form = cgi.FieldStorage()
|
2020-01-03 14:19:48 -05:00
|
|
|
if "file" in form:
|
|
|
|
plik = form["file"]
|
|
|
|
length = 0
|
|
|
|
if plik.file:
|
|
|
|
dig = hashlib.md5()
|
|
|
|
while 1:
|
|
|
|
data = plik.file.read(1000000)
|
|
|
|
if not data:
|
|
|
|
break
|
|
|
|
length += len(data)
|
|
|
|
dig.update(data)
|
2008-04-27 06:41:01 -04:00
|
|
|
|
2020-01-03 14:19:48 -05:00
|
|
|
print("Filename2 = " + plik.filename)
|
|
|
|
print("Size = %d" % length)
|
|
|
|
print("MD5 = " + dig.hexdigest())
|