Send file in base64

Jose Ignacio Gisbert jigisbert.etra-id at grupoetra.com
Wed Dec 5 01:47:50 EST 2007


Hi all,

 

I need to send a file to a server using xmlrpc api. The receiver must get
file data in base64 type, and what I do is:

 

openfilename=tkFileDialog.askopenfilename(filetypes=[("all files", "*")])

f=open(tlocald.get(),'r')

functionsend(xmlrpclib.Binary(f), f.name)

 

 And what I get is, at least:

 

base64.encode(StringIO.StringIO(self.data), out)

TypeError: expected a character buffer object

 

 But if I do:

 

openfilename=tkFileDialog.askopenfilename(filetypes=[("all files", "*")])

f=open(tlocald.get(),'r')

g=f.read()

functionsend(xmlrpclib.Binary(g), f.name)

 

It apparently works, but what I send becomes totally understanding, it is
like if I send only a bit part of the file.

 

Anyone who could help me?

 

Thanks in advance

 

Best regards, 

_______________________________
José Ignacio Gisbert Sanus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071205/f28f5187/attachment.html>


More information about the Python-list mailing list