in reply to Re: How to change content-length in CGI
in thread How to change content-length in CGI

Standalone script

#!/usr/bin/perl use strict; use warnings; use LWP::Simple::Post qw(post); #binary file open(FH, "binaryfile"); my $Data = do{local $/; <FH>}; close(FH); my $url = 'http://localhost:8080/cgi-bin/index.pl'; my $content = post($url, $Data); print $content;

Server script

#!/usr/bin/perl use strict; use CGI; my $q = new CGI; print "\nMethod :", $ENV{REQUEST_METHOD}; print "\nContent_Length : ", $ENV{CONTENT_LENGTH}; #binary file open (FH, ">binaryoutput"); print FH $q->param() if ($q->param()); close(FH);

In the server script, i need to do several process and also i don't want to upload concept. For some concept, I want to post the data and retrive in the server look like parameters

Replies are listed 'Best First'.
Re^3: How to change content-length in CGI
by Crackers2 (Parson) on Jan 05, 2009 at 15:02 UTC
    Could this be another binmode issue? Try adding a binmode FH right after opening your file. You could also print out the length of $Data right before you post it to make sure it's the size you're expecting.