POST method, CGI and file transfer
fuzzyman at gmail.com
Sat Sep 4 20:39:50 CEST 2004
Another http question.
First one is simple - if a POST is made *to* a CGI with file uplaods
then you can get a FieldStorage with list values - each entry in the
list being a file. Two questions about this :
1) Is this the only situation you'll get list values posted to a CGI ?
If you have a list value in your FieldStorage instance can you be sure
that it's files ?
2) If a post is made of 1 file will it still be a list ? (jsut with a
Admittedly the second one I could actually try... :-)
More complicated - I want to proxy the file posts, i.e. extract them
from the FieldStorage and re-encode them to make another post from the
CGI. How do you encode multipart file posts - I couldn't see it
obviously from teh standard libraries. For ordinary data I would use
I saw one solution at
this uses httplib and makes the post. I would *much* rather (if
possible) encode the files as headers in a Request object and use
urllib2 to make the post.
More information about the Python-list