Order of attachments in Multipart POST

D

David Wake

Does anyone know of a way to control the order of file attachments
sent in a multipart POST statement? They seem to be sent in a random
order each time.


use HTTP::Request::Common;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;

my $response = $ua->request(POST 'http://www.foo.com/forminput.cgi,
Content_Type => 'form-data',
Content => [
file1 => ["/home/dwake/file1"],
file2 => ["/home/dwake/file2"],
] );

The order in which file1 and file2 are attached seems to vary each
time this script is run. I would like to always send them in the same
order if possible.

Thanks,

David
 
T

Tulan W. Hu

David Wake said:
Does anyone know of a way to control the order of file attachments
sent in a multipart POST statement? They seem to be sent in a random
order each time.


use HTTP::Request::Common;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;

my $response = $ua->request(POST 'http://www.foo.com/forminput.cgi,
Content_Type => 'form-data',
Content => [
file1 => ["/home/dwake/file1"],
file2 => ["/home/dwake/file2"],
] );

The order in which file1 and file2 are attached seems to vary each
time this script is run. I would like to always send them in the same
order if possible.

Why do you need to care about the order of the files?
Use CGI module in the forminput.cgi and
$query->param('file1') and $query->param('file2') will allow
you to get the individual files. The order is not important.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top