John Maguire on Fri, 21 Jul 2000 10:04:15 -0400 (EDT)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

HTTP Post (Binary File Upload)


I've been reading the list mailers for some time now and have finally been faced with a task I cannot seem to complete. I am trying to perform an HTTP Post (on a Win32 system) of a binary file to a remote server. (i.e an automated non-text file upload process.) I have been using the LWP and HTTP Modules.

Essentially, I can upload the file with no apparent problems, but I cannot seem to set the content-type for the "file" form field to "application/octet-stream" (which is what my trading partners are expecting) without generating less than desired results. Any help would be great.

Below is the snippet in question.
###################################
#!perl

use HTTP::Request::Common;
require LWP::UserAgent;
require HTTP::Response;

$ua = new LWP::UserAgent;

$response = $ua->request(POST 'http://localhost/scripts/upload.pl',
	Content_Type => 'form-data',
	Content => [from => 'A',
		to => 'B',
		'input-format' => 'EDI (ANSI X.12)',
		'input-data' => ['c:\temp\marble.gif'],
	]);

print $response->as_string();
###################################

Thanks,

-John Maguire
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**