<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.bishopphillips.com/riskwiki/index.php?action=history&amp;feed=atom&amp;title=ParseRequest</id>
	<title>ParseRequest - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.bishopphillips.com/riskwiki/index.php?action=history&amp;feed=atom&amp;title=ParseRequest"/>
	<link rel="alternate" type="text/html" href="https://www.bishopphillips.com/riskwiki/index.php?title=ParseRequest&amp;action=history"/>
	<updated>2026-11-16T04:29:43Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://www.bishopphillips.com/riskwiki/index.php?title=ParseRequest&amp;diff=375&amp;oldid=prev</id>
		<title>Bishopj: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://www.bishopphillips.com/riskwiki/index.php?title=ParseRequest&amp;diff=375&amp;oldid=prev"/>
		<updated>2026-04-12T06:38:12Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 06:38, 12 April 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Bishopj</name></author>
	</entry>
	<entry>
		<id>https://www.bishopphillips.com/riskwiki/index.php?title=ParseRequest&amp;diff=374&amp;oldid=prev</id>
		<title>Bishopj: Created page with &quot;==TrwRequestContent - Improved Multipart/Form-data handling in Delphi ==  Language: Delphi 7   Refer: [http://www.winwright.ca/index.html http://www.winwright.ca/index.html]...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.bishopphillips.com/riskwiki/index.php?title=ParseRequest&amp;diff=374&amp;oldid=prev"/>
		<updated>2019-09-11T23:05:03Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==TrwRequestContent - Improved Multipart/Form-data handling in Delphi ==  Language: Delphi 7   Refer: [http://www.winwright.ca/index.html http://www.winwright.ca/index.html]...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==TrwRequestContent - Improved Multipart/Form-data handling in Delphi ==&lt;br /&gt;
&lt;br /&gt;
Language: Delphi 7&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Refer:&lt;br /&gt;
[http://www.winwright.ca/index.html http://www.winwright.ca/index.html]&lt;br /&gt;
&lt;br /&gt;
This unit can be used to parse out data returned from&lt;br /&gt;
html forms with ENCTYPE=&amp;quot;multipart/form-data&amp;quot; and Method=POST&lt;br /&gt;
Do NOT use on any other encoding.&lt;br /&gt;
&lt;br /&gt;
Reason for unit is the TWebRequest class in Delphi does not&lt;br /&gt;
provide correct handling for multipart data. These helper&lt;br /&gt;
classes provide this handling.&lt;br /&gt;
&lt;br /&gt;
==Description:==&lt;br /&gt;
&lt;br /&gt;
Create an instance of TrwRequestContent passing to the&lt;br /&gt;
constructor either the complete content from a TWebRequest&lt;br /&gt;
object or the TWebRequest instance itself. In the latter case &lt;br /&gt;
TrwRequestContent will take care of making sure all content&lt;br /&gt;
has been retrieved from the client.&lt;br /&gt;
&lt;br /&gt;
TrwRequestContent will first parse the boundary string used to&lt;br /&gt;
delimit each form item, then use that to parse the content of&lt;br /&gt;
all the individual fields. For each field parsed, that specific&lt;br /&gt;
content is passed to the constructor of a TrwRequestItem which&lt;br /&gt;
then parses it further to pull out the individual elements. For&lt;br /&gt;
most fields this simply consists of Name and Content. For&lt;br /&gt;
multi-select listbozes, the content will contain the choices&lt;br /&gt;
separated by semi-colons (;). For images, the FileName and&lt;br /&gt;
ContentType properties will also be provided. The Content will&lt;br /&gt;
be the actual image data and can be directly saved to file as&lt;br /&gt;
the appropriate type (e.g. .jpg or .gif).&lt;br /&gt;
&lt;br /&gt;
Once created, you can iterate the list of names using the&lt;br /&gt;
FieldName property, individual TrwRequestItems using the&lt;br /&gt;
Field property, or get the entire TStringList containing the names and&lt;br /&gt;
TrwRequestItem objects via the Fields property. FieldCount and&lt;br /&gt;
Contentlength are also available.&lt;br /&gt;
&lt;br /&gt;
Freeing the TrwRequestContent object will free all the&lt;br /&gt;
TrwRequestItem objects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
  Copyright © 2000 Winwright Inc. (Canada) All rights reserved.&lt;br /&gt;
  This unit may be freely used and distributed by anyone for use in&lt;br /&gt;
  any application commercial or otherwise as long as these comments&lt;br /&gt;
  including copyright are kept intact.&lt;br /&gt;
&lt;br /&gt;
  This unit can be used to parse out data returned from&lt;br /&gt;
  html forms with ENCTYPE=&amp;quot;multipart/form-data&amp;quot; and Method=POST&lt;br /&gt;
  Do NOT use on any other encoding.&lt;br /&gt;
&lt;br /&gt;
  Reason for unit is the TWebRequest class in Delphi does not&lt;br /&gt;
  provide correct handling for multipart data. These helper&lt;br /&gt;
  classes provide this handling.&lt;br /&gt;
&lt;br /&gt;
  Description:&lt;br /&gt;
    Create an instance of TrwRequestContent passing to the&lt;br /&gt;
    constructor either the complete content from a TWebRequest&lt;br /&gt;
    object or the TWebRequest instance itself. In the latter case&lt;br /&gt;
    TrwRequestContent will take care of making sure all content&lt;br /&gt;
    has been retrieved from the client.&lt;br /&gt;
&lt;br /&gt;
    TrwRequestContent will first parse the boundary string used to&lt;br /&gt;
    delimit each form item, then use that to parse the content of&lt;br /&gt;
    all the individual fields. For each field parsed, that specific&lt;br /&gt;
    content is passed to the constructor of a TrwRequestItem which&lt;br /&gt;
    then parses it further to pull out the individual elements. For&lt;br /&gt;
    most fields this simply consists of Name and Content. For&lt;br /&gt;
    multi-select listbozes, the content will contain the choices&lt;br /&gt;
    separated by semi-colons (;). For images, the FileName and&lt;br /&gt;
    ContentType properties will also be provided. The Content will&lt;br /&gt;
    be the actual image data and can be directly saved to file as&lt;br /&gt;
    the appropriate type (e.g. .jpg or .gif).&lt;br /&gt;
&lt;br /&gt;
    Once created, you can iterate the list of names using the&lt;br /&gt;
    FieldName property, individual TrwRequestItems using the&lt;br /&gt;
    Field property, or get the entire TStringList containing the names and&lt;br /&gt;
    TrwRequestItem objects via the Fields property. FieldCount and&lt;br /&gt;
    Contentlength are also available.&lt;br /&gt;
&lt;br /&gt;
    Freeing the TrwRequestContent object will free all the&lt;br /&gt;
    TrwRequestItem objects.&lt;br /&gt;
}&lt;br /&gt;
interface&lt;br /&gt;
&lt;br /&gt;
uses Classes, SysUtils, HTTPApp;&lt;br /&gt;
&lt;br /&gt;
type&lt;br /&gt;
{&lt;br /&gt;
  TrwRequestItem:&lt;br /&gt;
  - Contains data about a single item returned from an html form.&lt;br /&gt;
  - There&amp;#039;s no need to create these manually, they are created for&lt;br /&gt;
    you by calling the constructor of the TrwRequestContent class.&lt;br /&gt;
}&lt;br /&gt;
  TrwRequestItem = class&lt;br /&gt;
  private&lt;br /&gt;
    FName: string;&lt;br /&gt;
    FContentType: string;&lt;br /&gt;
    FFileName: string;&lt;br /&gt;
    FContent: string;&lt;br /&gt;
    FContentLength: integer;&lt;br /&gt;
  public&lt;br /&gt;
    constructor Create(const AContent: string);&lt;br /&gt;
    procedure AddValue(const AContent: string);&lt;br /&gt;
    property Name: string read FName;&lt;br /&gt;
    property ContentType: string read FContentType;&lt;br /&gt;
    property FileName: string read FFileName;&lt;br /&gt;
    property Content: string read FContent;&lt;br /&gt;
    property ContentLength: integer read FContentLength;&lt;br /&gt;
  end;&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
  TrwRequestContent:&lt;br /&gt;
  - Passed either the Content property of a TWebRequest class,&lt;br /&gt;
    or an instance of a TWebRequest class, will parse out the&lt;br /&gt;
    individual fields.&lt;br /&gt;
}&lt;br /&gt;
  TrwRequestContent = class&lt;br /&gt;
  private&lt;br /&gt;
    FList: TStrings;&lt;br /&gt;
    FBoundary: string;&lt;br /&gt;
    FContentLength: cardinal;&lt;br /&gt;
    FContent: string;&lt;br /&gt;
    procedure ClearList;&lt;br /&gt;
    procedure ParseFields(const data: string);&lt;br /&gt;
    function GetFieldCount: integer;&lt;br /&gt;
    function GetField(const index: string): TrwRequestItem;&lt;br /&gt;
    function GetFieldValue(const index: string): string;&lt;br /&gt;
    function GetName(index: integer): string;&lt;br /&gt;
    function GetNames: TStrings;&lt;br /&gt;
  public&lt;br /&gt;
    constructor Create(req: TWebRequest); overload;&lt;br /&gt;
    constructor Create(const AData: string); overload;&lt;br /&gt;
    destructor Destroy; override;&lt;br /&gt;
    property ContentLength: cardinal read FContentLength;&lt;br /&gt;
    property Content: string read FContent;&lt;br /&gt;
    property FieldCount: integer read GetFieldCount;&lt;br /&gt;
    property Field[const index: string]: TrwRequestItem read GetField;&lt;br /&gt;
    property FieldValue[const index: string]: string read GetFieldValue;&lt;br /&gt;
    property FieldName[index: integer]: string read GetName;&lt;br /&gt;
    property FieldNames: TStrings read GetNames;&lt;br /&gt;
  end;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=BackLinks=&lt;br /&gt;
&lt;br /&gt;
{{#dpl: linksto={{FULLPAGENAME}} }}&lt;/div&gt;</summary>
		<author><name>Bishopj</name></author>
	</entry>
</feed>