[phpxmlrpc] XMLRPC Binary Transfer

Frank H celery187 at hotmail.com
Wed Jan 21 20:34:09 CET 2009


Hi all,

I am trying to create a function that allows me to send binary files from a client and have the server write it into a directory.
I have it working right now, but it errors when I try to send a file greater then about 300 Kb.  Any file under that size will
transfer just fine.



Here is the function I have on the server...

function upload_file2($m)
{
    $param1 = $m->getParam(0);
    $write_file = $param1->scalarval();
    $convert_file = fopen($write_file, "rb");

    $param2 = $m->getParam(1);
    $file_name = $param2->scalarval();

    $test_write = fopen("/tmp/".$file_name, "w");
    fwrite($test_write, $write_file);
    fclose($test_write);

    return new xmlrpcresp(new xmlrpcval($file_name));
}

$upload_file2_sig = array(array($xmlrpcBase64,$xmlrpcBase64, $xmlrpcString));
$upload_file2_doc = 'uploads a binary file';



I am using a Python client to send the file.  I was playing around with a Python server to transfer files and the Python
server does not run into any problems with file size.

This is what I have on the python client...

import xmlrpclib

print("Trying to connect...")
server_url = 'http://some_url/new_server.php';
server = xmlrpclib.Server(server_url);

handle = open("nova.bmp")
file_name = "fetch_nova.bmp"
send_file = server.sendFile(xmlrpclib.Binary(handle.read()), file_name)


This is the error I get when trying to use the Python Client/Php Server combo

Trying to connect...
Traceback (most recent call last):
  File "testProc_client.py", line 20, in ?
    send_file = server.sendFile(xmlrpclib.Binary(handle.read()), file_name)
  File "/usr/lib/python2.3/xmlrpclib.py", line 1029, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.3/xmlrpclib.py", line 1316, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.3/xmlrpclib.py", line 1070, in request
    headers
xmlrpclib.ProtocolError: <ProtocolError for mmodev.jpl.nasa.gov/frank/xmlrpc/demo/server/new_server.php: -1 >


Any help would be greatly appreciated.
Thanks!

-Frank


_________________________________________________________________
Windows Live™ Hotmail®:…more than just e-mail. 
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_explore_012009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.usefulinc.com/pipermail/phpxmlrpc/attachments/20090121/98ce3c71/attachment.htm 


More information about the phpxmlrpc mailing list