[Tutor] upload xml file via pycurl

Alan Gauld alan.gauld at btinternet.com
Tue May 17 00:02:09 CEST 2011


"Rayon" <evosweet at hotmail.com> wrote

>I am trying to upload a xml file via pycurl, I really need some help 
>here.

So give us a clue.
What is wrong with your code? And what does the real code
look like, the fragment you have posted doesn't tell us too
much - what is c? what have you imported, and how did you do it?

Are you getting an error - if so what does it say?
Are you getting bad data out? If so what did you get?
What did you expect?

"I really need some help" doesn't tell us much.


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

> url = "https://192.168.0.68/fileupload/upload_file.php"
> binaryptr = open('activation.xml','rb').read()
> head = ['Content-type:text/xml']
>
> c.setopt(c.SSL_VERIFYPEER, 0)
> c.setopt(c.SSL_VERIFYHOST, 0)
> c.setopt(c.POSTFIELDS,binaryptr)
> c.setopt(c.POSTFIELDSIZE,23L)
> c.setopt(c.HTTPHEADER,head)
> c.setopt(c.URL, url)
> c.setopt(c.VERBOSE, 1)
> c.perform()





More information about the Tutor mailing list