The CGI:: module limits largest file size with a variable called
$CGI::POST_MAX.  From the documentation:

" [ ...]
If set to a non-negative integer, this variable puts a ceiling on the size
of POSTings, in bytes. If CGI.pm detects a POST that is greater than the
ceiling, it will immediately exit with an error message. This value will
affect both ordinary POSTs and multipart POSTs, meaning that it limits the
maximum size of file uploads as well. You should set this to a reasonably
high value, such as 1 megabyte.
[...] "


You don't say that you're using CGI, but something similar may well apply
to your situation.  This limit would be enforced by the receiving server.
There may also be a similar limit with LWP or HTTP::Request which applies
to your code shown here as well.  




At 07:38 PM 2/9/04 +0530, Nilay   Puri, Noida wrote:
>Hi all,
>
>I am uplaoding files from one server to another server using Perl HTTP post.
>
>But when the file size increases to 2 MB , i get error.
>
>Is there any way I can specify the max file size ?
>My code is :
>#!usr/local/bin/perl -w 
>use LWP::Simple;
>use Data::Dumper;
>use LWP::UserAgent;
>use HTTP::Request::Common qw/POST/;
>LWP::Debug::level('+') ;
>
>my $ua= LWP::UserAgent->new(env_proxy => 1, keep_alive => 1, timeout =>
>7800,);
>my $file="/home/hewebadm/nilay/test1.txt" ;
>my $filename="323272-1980-test1.txt" ;
>
>$linktext = "test1.txt" ;
>my $url="http://downloaddev.pearsoncmg.com/extmanage/extpost.php"; ;
>$request = POST $url,
>      Content_Type =>  'multipart/form-data',
>       Content      => [ 
>                        file  => ["$file"], 
>                        filename => "$filename",
>                        action => "insert",
>                         parentisbn   => "0131406701",
>                         linktext => "test1.txt",
>                         type   => "Presentations",
>                        imprint =>"ph" ,
>#                       secret =>
>"08ER0L%29N04P73N9%3ACW%2ANC%5F%250%20%0A" ,
>                       ];
>my $results=$ua->request($request ) ;
> ;   die "$url error :::::::::", $results->status_line unless
>$results->is_success ;
>
>#sleep 100;
>#To dump the whole data use this otherwise comment it
>#print Dumper($results);
>print "\n\n\n" ;
>if($results->is_success){
>       print "The request method was :".$request->method() ;
>       print "\n" ;
>       print "The requested url was :".$request->url() ;
>       print "\n" ;
>#      print "The request you sent was :".$request->content() ;
>       print "\n\n\n" ;
>       print "The response you got :".$results->content() ;
>       print "\n" ;
>} 
>else {
>   print "It didnt work";
>   print $results->status_line();
>}
>
>Regards,
>
>-- 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
><http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to