On Thu, Sep 10, 2009 at 12:31 PM, deepak gupta <dg288_m...@yahoo.co.in>wrote:

> Hi All,
>
> How to send 1 GB Zip file to some remote machine using HTTP/HTTPS?
>
> As of now :
> I am running a http listner in to remote machine.
> I want to copy a file from local system to the remote machine where my
> HTTP/HTTPS Listner is running.
> Currently i am comressing the file, then reading the file and sending the
> contents to the remote agent as a string.
> At Remote agent , i am reading the string content and writing the same in
> to the file.
>
> this methord is OK when the file size is small ,like 100 MB or 200 MB.
>
> But it will give problem when i will transfer the large file say 1GB or 2
> GB.
> because till the file writing contents will be in the memory, so possible
> errors can come as out of memory or it may not be able to send the large
> file so socket error can also come.
>
>

I just wrote some code to do something very similar:

http://github.com/CarlFK/veyepar/blob/master/dj/scripts/blip_uploader.py

It is a bit messy, mainly because it has to send the size of the whole post
including the metadata.   but it does not do
x+=file('foo.ogg','rb').read()

h = httplib.HTTPConnection(host)
h.putheader("content-length",len(x) )
h.send(x)

which was crashing when foo.avi 600meg

The part that actually transferes the file:

        f = open(filename,'rb')
        block=f.read(10000)
        while block:
            h.send(block)
            bytes_sent += len(block)
            if progress: progress(bytes_sent,datalen)
            block=f.read(10000)


If someone can figure out how to refacter PostMultipart so it isn't so
messy...


So is there any other way to transfer the large file, size i have mention
> above using HTTP/HTTPS.
>
> Please mention if i can do it by using some other protocol.
>
> Thanks and Regards,
> Deepak
>
>
>
> ------------------------------
> See the Web's breaking stories, chosen by people like you. Check out Yahoo!
> Buzz <http://in.rd.yahoo.com/tagline_buzz_1/*http://in.buzz.yahoo.com/>.
>
> _______________________________________________
> BangPypers mailing list
> BangPypers@python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
>


-- 
Carl K
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to