How could i Post binary data to perl cgi?
Alejandro Tejada
capellan2000 at yahoo.com
Sat Feb 21 19:19:54 EST 2004
on Sat, 21 Feb 2004 11:00:12 -0500
"shaosean at unitz.ca" wrote:
Content-type: multipart/form-data;
boundary=---------------------------277072699622422
> you're forgetting the "boundary" marker.. (note that
> the above is all
> one line, or two seperate lines with LWS before the
> word "boundary")
Thanks a lot Sean for step-in on this question.
I've add the boundary marker, but this only
produces the same error.
I'm using the perl cgi script: "Upload Lite"
from the site:
<http://www.perlscriptsjavascripts.com/perl/upload_lite/>
Do you have success uploading files to a cgi or
php script in a server from RR/MC?
I noticed that you use base64encode to attach
files to email messages.
Does libUrl supports uploading binary files
in this way?
Dave Cragg does not says that uploading binary
files using post will not works, so i'll keep
posting my errors, so interested developers
will help or at least not repeat them.
Thanks again Sean! :-)
al
on Sat, 21 Feb 2004 07:47:52 -0800 (PST)
Alejandro Tejada wrote:
> Hi Developers,
>
> I have been working hard to employ
> the method "post" for uploading
> files to a web server.
>
> I have used "HTTP interceptor v1.3"
> to check the differences between the
> data send by browsers and RR/MC.
>
> These are the results:
>
> Http headers send from Netscape:
>
> POST /cgi-bin/upload.cgi HTTP/1.0
> Referer: http://www.mywebsite.com/postfiles.html
> Connection: Close
> User-Agent: Mozilla/4.8 [en] (Win98; U)
> Host: www.mywebsite.com
> Accept: image/gif, image/x-xbitmap, image/jpeg,
> image/pjpeg, image/png, */*
> Accept-Encoding: gzip
> Accept-Language: en
> Accept-Charset: iso-8859-1,*,utf-8
> Content-type: multipart/form-data;
> boundary=---------------------------277072699622422
> Content-Length: 15909
>
> Data found after header end:
>
> -----------------------------277072699622422
> Content-Disposition: form-data; name="FILE1";
> filename="C:\Mis documentos\candado.gif"
> Content-Type: image/gif
>
> GIF89aJ
>
>
> Based in these results, i changed the script
> to closely match the http produced by Netscape:
>
> This was the headers result:
>
> POST /cgi-bin/upload.cgi HTTP/1.1
> Host: www.mywebsite.com
> User-Agent: Metacard (Win32)
> Content-Length: 15703
> Content-type: multipart/form-data
>
> Data found after header end:
>
> Content-Disposition: form-data; name="FILE1";
> filename="C:\Mis documentos\candado.gif"
> Content-Type: image/gif
>
> GIF89aJ
>
> But the server returns
> Malformed Post request. :-(
>
> This is the script that
> produced this malformed post:
>
> on mouseUp
> -- Setting httpheaders as recommended by Dave
> Cragg
> -- in the message "HTTP headers for posting data"
> put "Content-type: multipart/form-data" into
> tHeaders
> set the httpHeaders to tHeaders
>
> put "http://www.mywebsite.com/cgi-bin/upload.cgi"
> into
> tUrl
> put "Content-Disposition: form-data; name=" &
> quote
> & "FILE1" & quote & "; filename=" & quote & "C:\Mis
> documentos\candado.gif" & quote into tString
> put crlf after tString
> put "Content-Type: image/gif" after tString
> put crlf & crlf after tString
>
> set the customprop1 of the topstack to url
> "binfile:C:/Mis documentos/candado.gif"
> put the customprop1 of the topstack after tString
> put crlf after tString
> post tString to url tUrl
> -- put tString -- uncomment for debug
> if the result is empty
> then
> put it --
> set the htmltext of fld "result" to it
> else
> answer the result
> end if
> end mouseUp
>
> If you could see the errors in this script,
> post them here or send clues to my mail.
>
> Thanks in advance.
>
> al
=====
Visit my site:
http://www.geocities.com/capellan2000/
Search the mail list:
http://mindlube.com/cgi-bin/search-use-rev.cgi
__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools
More information about the use-livecode
mailing list