Promotic
WikipediaLinkedInYoutubeTwitterFacebook

HttpFormDataParse - method of the Pm object

Description:
Parsing data from uploaded files or values in the form of multipart/form-data.
Syntax:
PmArray HttpFormDataParse(Object oData)
Parameters:
oData(Object) The PmBuffer object containing data regarding the file(s) uploaded by client.
Return values:
Returns an PmArray of PmMap objects in the following structure:
PmMap.Name = Name
PmMap.File = File name
PmMap.Type = Type (text/plain, application/x-zip-compressed, image/jpeg, ...)
PmMap.Value = Text or binary data of the file
Note:
The HTML form can send data by the POST method to server in a simple text form application/x-www-form-urlencoded, e.g. "Name1=Value1&Name2=Value2 ...", where the individual values can then be read by Pm.HTTPGetFormValue.
 
The HTML form can also send the data by the POST method to server in a complex binary form multipart/form-data, that may contain text values together with binary data and files. The raw data in the form of PmBuffer can then be processed by the Pm.HttpFormDataParse method.
 
The method should facilitate the work with HTML forms because it removes manual decoding of the received data.
 
This method is not functional in Web panels.
Example1:
An array of maps containing data from files uloaded by client.
JavaScriptVBScriptSelect and copy to clipboard

var aParts = Pm.HttpFormDataParse(oData);
Example2:
Parsing file data. Script in the onPageAction event of the PmaWebDir object.
JavaScriptVBScriptSelect and copy to clipboard

var i;
var oData = pEvent.Data;
if (Pm.GetVarType(oData, 1) == "PmBuffer")
{
var aParts = Pm.HttpFormDataParse(oData);
for (i = 0; i < oData.GetSize(1); i++)
{
var mPart = aParts.GetItem(i, -1);
Pm.Debug(mPart.Name);
Pm.Debug(mPart.File);
Pm.Debug(mPart.Type);
Pm.Debug(mPart.Value.GetSize());
}
}

History:
Pm9.00.15: Created
PROMOTIC 9.0.15 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
- Pm
 
- Abs
- Cos
- E
- Exp
- HttpFormDataParse
 
 
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice