file upload via http
Joost van Rooij
joost_vanrooij.net
Mon Nov 18 11:05:59 EST 2002
Hello,
I would like to upload a picture (generated by a webcam) to be uploaded to
my website. I don't want to use the ftp protocol because of a firewall which
only allows me to connect via http.
I tried to do this using the code below but that didn't seem to work, can
somebody help me out?
Joost
import httplib
body = open("./image.jpg","r")
headers = {"Content-type": "multipart/form-data",
"Accept": "image/jpeg"}
conn = httplib.HTTPConnection("www.server.net:80")
conn.request("POST", "/showme/picture/upload.php",body , headers)
response = conn.getresponse()
print response.status, response.reason
conn.close()
More information about the Python-list
mailing list