Skip to content
This repository
tree: c447e50a7a
Fetching contributors…

Cannot retrieve contributors at this time

file 24 lines (19 sloc) 0.76 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
import StringIO, cgi

content = """-----------------------------265001916915724
Content-Disposition: form-data; name="F1"; filename="fileA.txt"
Content-Type: text/plain

I'm file A.
-----------------------------265001916915724
Content-Disposition: form-data; name="F2"; filename="fileB.txt"
Content-Type: text/plain

I'm file B.
-----------------------------265001916915724
Content-Disposition: form-data; name="F3"; filename="fileA.txt"
Content-Type: text/plain

I'm file A2.
-----------------------------265001916915724--"""
print len(content)
headers = {"content-type":"multipart/form-data; boundary=---------------------------265001916915724" }

fp = StringIO.StringIO(content)
fs = cgi.FieldStorage(fp,headers,environ={ 'REQUEST_METHOD':'POST' })
print fs
Something went wrong with that request. Please try again.