Ask a Question related to PERL Beginners, Design and Development.
-
Nilay Puri #1
Uploading large files thru HTTP
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,
Nilay Puri Guest
-
uploading large files with fileReference
Hello Forum I am encoutering trouble with fileuploading using the new flash 8 fileReference class. The server seems to be set up to handle... -
uploading large files through ASP
Hi , I have a requirement where i need to upload big files to the server through a web browser. Something like a file upload in mail... -
Illustrator CS files with large linked files results in large file size
If I place a large linked Photoshop 7 file (.psd or.eps), say 36 MB, in Illustrator CS and save without embedding the file it takes ages to save and... -
Uploading large files - error "stat failed"
Hello, I have a page where i can upload binary file (using the HTML input type=file approach). This works fine for relatively small files... -
Uploading large files
It's in the web config... <httpRuntime executionTimeout="2400" maxRequestLength="131072" /> There's a practical limit as well. The... -
Michael C. Davis #2
Re: Uploading large files thru HTTP
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]beginners-unsubscribe@perl.org[/email]
>For additional commands, e-mail: [email]beginners-help@perl.org[/email]
><http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
>Michael C. Davis Guest
-
Bob Showalter #3
RE: Uploading large files thru HTTP
Nilay Puri, Noida wrote:
You can only do this if you control the server. Do you?> 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 ?
Bob Showalter Guest
-
Bob Showalter #4
RE: Uploading large files thru HTTP
Bob Showalter wrote:
I should clarify that. You need to control the server receiving the post.> 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 ?
> You can only do this if you control the server. Do you?
That's where the size limit is being enforced.
Bob Showalter Guest



Reply With Quote

