overrider has asked for the wisdom of the Perl Monks concerning the following question:
What id like to do now is to build a callback function, so that when I POST the file, it will basically read the File chunk by chunk. That way even if i upload a 1GB Movie, Memory used stays pretty much the same. I tried to implement it like thisOut of memory during "large" request for 536875008 bytes, total sbrk() + is 7065600 bytes at /usr/local/lib/perl5/site_perl/5.8.9/HTTP/Reques +t/Common.pm line 160.
When running the Program, i get amy $filename = "largefile.avi"; open(FH,"<$filename"); my $upload_cb = sub { if ( sysread FH, my $buffer, 4096 ){ return $buffer; } else { close FH; return ''; } } # later in the Code, when uploading the File, calling it like this $vid_fields{field_uploadfile} = [ $upload_cb ] ; $vid_fields{field_private_share_entities} = ""; $resp = upload_step_two($action_url, \%vid_fields);
Can someone give me a simple Example of POSTing a large File when using LWP::Useragent? Thanks a lotCan't open file CODE(0x821d6d4): No such file or directory at /usr/loc +al/lib/perl5/site_perl/5.8.9/LWP/UserAgent.pm line 401
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: POST'ing a large File with LWP::UserAgent
by Anonymous Monk on May 03, 2009 at 06:21 UTC | |
by Anonymous Monk on May 03, 2009 at 06:59 UTC | |
by Anonymous Monk on Nov 30, 2011 at 06:34 UTC | |
by Anonymous Monk on Nov 30, 2011 at 08:32 UTC |