I'm posting this because I finally figured how to send files(pictures in particular) over xmlrpc. It took me a while to figure it out since I was mostly concerned with saving the files into database but here it is.
from twisted.web import xmlrpc, server
def xmlrpc_savefile(self, file):
datum = file.data
thefile = open('/tmp/gnu.jpg', "wb")
#filebuffer = file
#os.spawnl(os.P_NOWAIT, '/usr/bin/display', '/tmp/gnu.jpg')
if __name__ == '__main__':
from twisted.internet import reactor
r = PositRPC()
Then I opened trusty IDLE
>>> import xmlrpclib
>>> s = xmlrpclib.Server('http://127.0.0.1:7080')
>>> d = xmlrpclib.Binary(open('/home/pras/PicasaDocuments/gnu.jpg', 'rb'))
The idea here is that although the file is sent as a Binary, we need to convert it to string(bytes) to save it. Since we have opened the file with 'rb' option in IDLE and with 'wb' option in our server (respectively for read binary and write binary), we get binary file at the server end.