]> git.llucax.com Git - personal/website.git/blob - source/blog/publish.cgi
Make https:// compatible
[personal/website.git] / source / blog / publish.cgi
1 #!/usr/bin/env python
2 #coding: utf8
3
4 import cgi
5 print "Content-Type: text/html"     # HTML is following
6 print                               # blank line, end of headers
7 form = cgi.FieldStorage()
8 img = form["img"]
9 imgsz = form["imgsz"]
10 print imgsz
11 if img.file:
12         # It's an uploaded file; count lines
13         rcv = 0
14         while 1:
15                 chunk = img.file.read(1024)
16                 if not chunk:
17                         break
18                 rcv += len(chunk)
19
20 assert rcv == imgsz
21