"Eric Langheinrich" <[EMAIL PROTECTED]> writes:

> I'm attempting to post a file in a multipart/form-data post using
> LWP::UserAgent and the following command string:
> 
>  my $response = $ua->request(POST $baseurl, Content_Type => 'form-data', 
> Content => [ request_params => $task_add_postkey, datafile => 
> [$task_add_datakey] ]);
> 
> 
> Where $task_add_postkey is a set of key value pairs of form data,
> and $task_add_datakey is the full path file name of a file
> containing binary data. The post seems to work fine with the
> exception of the 48 byte file I am sending, is received as 61 bytes
> on the server. I'm assuming it has something to do with how the file
> is being parsed.

Are you able to inspect the file received on the server side to figure
out what is actually different?

> Is there a better way to put together a multipart post? Am I missing
> something obvious? Is there a way to control the file parser so that
> the data is handled as raw binary data?

The file should already be included as binary.  There is no file
parser involved.

> Any ideas????

Try to print the request that POST() returns above to see if you can
spot what is wrong.

  $req = POST($baseurl, ....);
  print $req->as_string;
  
  $res = $ua->request($req);
  ...

Regards,
Gisle

Reply via email to