views:

82

answers:

3

I'm trying to upload a huge file from my Nokia N95 mobile to my webserver using Pys60 python code. However the code crashes because I'm trying to load the file into memory and trying to post to a HTTP url. Any idea how to upload huge files > 120 MB to webserver using Pys60.

Following is the code I use to send the HTTP request.

    f = open(soundpath + audio_filename)
    fields = [('timestamp', str(audio_start_time)), ('test_id', str(test_id)), ('tester_name', tester_name), ('sensor_position', str(sensor_position)), ('sensor', 'audio') ]
    files = [('data', audio_filename, f.read())]
    post_multipart(MOBILE_CONTEXT_HOST, MOBILE_CONTEXT_SERVER_PORT, '/MobileContext/AudioServlet', fields, files)
    f.close
A: 

You can't. It's pretty much physically impossible. You'll need to split the file into small chunks and upload it bit by bit, which is very difficult to do quickly and efficiently on that sort of platform.

Jamie

Jamie Rumbelow
A: 

You'll need to craft a client code to split your source file in small chunks and rebuild that pieces server-side.

Rubens Farias
A: 

where does this post_multipart() function comes from ?

if it is from here, then it should be easy to adapt the code so that it takes a file object in argument and not the full content of the file, so that post_mutipart reads small chunks of data while posting instead of loading the whole file in memory before posting.

this is definitely possible.

Adrien Plisson