🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #3353

Help on how to decode multipart/form-data

#3353
From: noel
Date: Mon, 24 Oct 2005 18:10
37 lines
2056 bytes
Hello All.

I am building a HTTP server and trying to decode the data from an HTML 
form. The form action is POST and it has a File field.
The form is sent as a "multipart/form-data" instead of the more familiar
"application/x-www-form-urlencoded" form.

the TIdHTTPRequestInfo -> Params does not contain the parameters as 
usual as these are transfered as the different parts of the message ...

+----
  Content-type: multipart/form-data, boundary=AaB03x

         --AaB03x
         content-disposition: form-data; name="field1"

         Joe Blow
         --AaB03x
         content-disposition: form-data; name="pics"
         Content-type: multipart/mixed, boundary=BbC04y

         --BbC04y
         Content-disposition: attachment; filename="file1.txt"
+---------+

My question is how do i decode the different parts from the 
TidHTTPServer OnCommandGet handler ...
Do i need to use another component ?

There is a TIdMultiPartFormDataStream that is used to
send such POST request as a client ... but i need to do the reverse
that is to receive and decode ...

Any help anyone ?
Many thanks !

No�l Bouchard
Technical Details
Message-ID: <435d2270$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,a70bb79561966dc0,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII
Date: Mon, 24 Oct 2005 14:10:02 -0400
From: noel <noel@teledata.qc.ca>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Help on how to decode multipart/form-data 
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 207.96.139.72
Message-ID: <435d2270$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1130177136 207.96.139.72 (24 Oct 2005 11:05:36 -0700)
Lines: 37
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail