Problem with file-upload using HTTP::Request::Common

A

Alex

I have read many of the other threads on this topic, but none quite
seem to answer my query - any advice would therefore be greatly
appreciated.

I have a form with about 20 parameters on, one of which is a file
upload field. If i submit this form directly to the MASCOT fileserver,
it functions correctly - all parameters and their values are passed.

However, if I convert the form into a self-targetting form, capture all
the parameters and their values (using $cgi_obj->Vars(); ), and then
pass the resulting hash reference to:

my $request = POST 'http://my/url/here/prog.exe',
Content_Type => 'form-data',
Content => $param_hash_reference;

: in this case the server complains that the file did not exist or i
entered no data.
(i'm doing this so i can capture the html returned from the file-server
in a response object. I have already created the necessary UA object.)

I have read the HTTP::Request::Common docs repeatedly, and experimented
with all the methods demonstated there, but i cannot suceed in making
it work. Any pointers/suggestions as to where i'm going wrong are
therefore appreciated.
Please be assured this is a last resort, and I am not intending to
waste anyone's time.

Thanks and Regards

Alex
 
G

Gunnar Hjalmarsson

Alex said:
if I convert the form into a self-targetting form, capture all
the parameters and their values (using $cgi_obj->Vars(); ), and then
pass the resulting hash reference to:

my $request = POST 'http://my/url/here/prog.exe',
Content_Type => 'form-data',
Content => $param_hash_reference;

: in this case the server complains that the file did not exist or i
entered no data.
(i'm doing this so i can capture the html returned from the file-server
in a response object. I have already created the necessary UA object.)

I have read the HTTP::Request::Common docs repeatedly, and experimented
with all the methods demonstated there, but i cannot suceed in making
it work. Any pointers/suggestions as to where i'm going wrong are
therefore appreciated.

I believe you are going wrong already by using the CGI::Vars() method.
AFAIK, that method can't be used to parse a file upload request, since
the values of the file select controls aren't also file handles.

Probably you need to save the file, parse the other parameters, and
create a fresh file upload request.
 

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,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top