Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Problem with file-upload using HTTP::Request::Common

Reply
Thread Tools

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

 
 
Alex
Guest
Posts: n/a
 
      03-19-2006
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

 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      03-20-2006
Alex wrote:
> 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.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem using problem reporting Kue2 Windows 64bit 3 01-15-2010 08:07 PM
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM
Problem connecting to https using ZSI (openssl problem) - python2.3 Adil Hasan Python 3 01-29-2004 12:27 AM
Using GetOleDbSchemaTable to get SQL Server Field Description - using pete ASP .Net 1 08-29-2003 10:50 AM
Re: MVP? Index error on nested element using System.xml but NOT using msxml??? William F. Robertson, Jr. ASP .Net 1 06-25-2003 08:08 PM



Advertisments