Upload - File transfers from the Web client to server

The PmaWebDir object allows to provide a html page with a form that allows the client to select file(s) located on the Web client computer and send them to server.

Page template (upload.htm):
<title>Upload file</title>
<style type="text/css">
body {background-color:#efefef;}
hr,div {width:400px;}
h2 {color:#000080;text-align:center;}
<h2>Select a file to upload to the server</h2>
<form enctype="multipart/form-data" method="post" action="#">
File to upload: <input id="fileupload" name="myfile" type="file" multiple/><hr/>
<input type="submit" id="submit" value="Upload to server"/>

The page can also be created in the script in the onPageModify event if the "Data source" configurator is set to Text set into the pEvent.PageString property in the onPageModify event. Such approach is used in the preconfiguration Preconfiguration "PmaWebDir - Uploading files from Web client to server".

The processing of received files and saving into the #data: folder is executed in the onPageAction event as follows:
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);
mPart.Value.SaveToFile(0, "#data:" + mPart.File, 0, -1);
Opening the page:
Script in the onButtonUp event of the PmgButton object that opens the upload.htm page of the PmaWebDir object that can be used for sending the file to server.
JavaScriptSelect and copy to clipboard

Pm.CreateView(pMe.PmPanel, "/Web/Dir", "file:upload.htm", "target:_blank;").Open();

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

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice