Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

FILE UPLOAD

by Battle_Fury (Initiate)
on Oct 05, 2007 at 03:11 UTC ( [id://642818]=perlquestion: print w/replies, xml ) Need Help??

Battle_Fury has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I'm trying to upload a file through the HTTP::Request::Common using the POST method by changing the type to 'form-data' etc.. But instead of going to the next page,I'm getting an error message "Error while sending the Email 006~ASP 0207~Cannot use Request.Form~Cannot use Request.Form collection after calling BinaryRead."

Thing is, even if I use the browser manually, the upload works only in IE and not in firefox. Using Live HTTP Headers, I've pasted the headers sent below and have also pasted the POST section of my Perl code. Pls hav a look and lemme know what I need to change for transition to the next page without gettig this error msg:
In I.E:

(Method-Line) POST /NOTIS/IPAllocation/IPAllocNetsUploadProcess.asp + HTTP/1.1 Accept image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, applica +tion/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms- +powerpoint, application/msword, */* Referer https://netinfo.ti.citigroup.net/NOTIS/IPAllocation/IPAlloc +NetsUpload.asp Accept-Language en-us Content-Type multipart/form-data; boundary=------------------------ +---7d72422611022c UA-CPU x86 Accept-Encoding gzip, deflate User-Agent Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoP +ath.1; .NET CLR 2.0.50727) Host netinfo.ti.citigroup.net Content-Length 64340 Connection Keep-Alive Cache-Control no-cache Content-Disposition: form-data; name="file1"; filename="10.26.0.0.csv"

Perl Code:
$mech->request(POST 'https://netinfo.ti.citigroup.net/NOTIS/IPAllocati +on/IPAllocNetsUploadProcess.asp', Content_Type => 'form-data', Content => ["file1" => ["C:/Scripting/Upload/10.26.0.0.csv +" => "10.26.0.0.csv" => "application/vnd.ms-excel"], "submit2" => "Upload", ]); print $mech->content;

Replies are listed 'Best First'.
Re: FILE UPLOAD
by erroneousBollock (Curate) on Oct 05, 2007 at 03:25 UTC
    I'm trying to upload a file through the HTTP::Request::Common using the POST method by changing the type to 'form-data' etc.. But instead of going to the next page,I'm getting an error message

    "Error while sending the Email 006~ASP 0207~Cannot use Request.Form~Cannot use Request.Form collection after calling BinaryRead."

    Assuming that you didn't write the VBScript (ASP) in question, I'd say that the server code is poorly written and is getting a (probably) valid HTTP request that it can't handle... probably a combination of bad assumptions by the author.

    The error is saying that the server code is trying to access form fields after the request data has been "consumed" by a call to BinaryRead - likely to support the file-upload facility.

    This is very unlikely to be your fault.

    Thing is, even if I use the browser manually, the upload works only in IE and not in firefox.
    Well that confirms it... written by fools, only tested on IE.

    Whether or not there's a problem with the content of your request, it shouldn't have that kind of impact on the server-side scripts.

    -David

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://642818]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-25 15:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found