Hi all,
 I am trying to process a HTTP POST using CGI.pm (appended below).  The
encoding is multipart/form-data. One(or more) of these parts is(are) jpg
images. I an curently dumping the name = value pairs using the following
program:

#!/usr/bin/perl -wT

use strict;
use CGI;

my $q = new CGI;
print $q->header( "text/plain" );
my( $name, $value );

open LOGFILE, ">> /tmp/log" || die();

foreach $name ( $q->param ) {
    print LOGFILE "$name=";
    foreach $value ( $q->param( $name ) ) {
        print LOGFILE "$value\n";
    }
}
close LOGFILE;


This produces the following output :

BOTZSERIAL=00:02:D3:00:01:01 
ALERTPPIC_0=campic1.jpg
ALERTPICTIME_0=984450623
ALERTPPIC_1=campic2.jpg

So it sees the filename but not the data itself. Problem is that I want to
save the Jpg pictures in some other files and the
"BOTZSERIAL=00:02:D3:00:01:01" type info in some other file, but I am not
seeing the binary (jpg) data at all. How do I extract the .jpg files from
this POST?

Thanks,
-ansh

#------------------------------

POST /picalert HTTP/1.1
Authorization: Basic bmV0Ym90ejpwYXNzd29yZA==
Host: 192.168.1.218:81
Content-Type: multipart/form-data;
boundary=----------------------------00000193AAD31E8
User-Agent: NetBotz/1.1.3
Accept: */*
Accept-Encoding: gzip
Accept-Language: en

------------------------------000000193AAD31E8
Content-Disposition: form-data; name="BOTZSERIAL"

00:02:D3:00:01:01

------------------------------000000193AAD31E8
Content-Disposition: form-data; name="ALERTPPIC_0"; filename="campic1.jpg"
Content-Type: image/jpeg

{binary data for picture}
------------------------------000000193AAD31E8
Content-Disposition: form-data; name="ALERTPICTIME_0"

984450623
------------------------------000000193AAD31E8
Content-Disposition: form-data; name="ALERTPPIC_1";filename="campic2.jpg"
Content-Type: image/jpeg

{binary data for picture}
------------------------------000000193AAD31E8



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to