Uploading large files thru HTTP

Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    3. 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...
    4. 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...
    5. Uploading large files
      It's in the web config... <httpRuntime executionTimeout="2400" maxRequestLength="131072" /> There's a practical limit as well. The...
  3. #2

    Default 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

  4. #3

    Default RE: Uploading large files thru HTTP

    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?
    Bob Showalter Guest

  5. #4

    Default RE: Uploading large files thru HTTP

    Bob Showalter wrote:
    > 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?
    I should clarify that. You need to control the server receiving the post.
    That's where the size limit is being enforced.
    Bob Showalter Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139