Queries the currently active page for the specified HTML form. If this form is found, the function submits the form, including specified files, to the Web server by means of the HTTP POST method and reads the response page. If the retrieved document is of content type HTML, it is parsed and embedded documents are requested. This function implements a RFC1867-compliant file upload function for form-based file upload in HTML.
This is a mapping to WebPageSubmitBin function, and uses a form specified in the dclform section to construct the data to post to the server.
The form consists of name-value pairs as usual, only the files to upload need a minor modification: a file to upload needs to be specified by a name-value pair in the following way:
"filename" := "<name of the input tag>;<file name>;<content type>";
Upload of file c:\test.txt
HTML code:
<form enctype="multipart/form-data" action="data2html.asp" method=post> <input type="text" name="anyname" value="anyvalue"> <input size="32" name="my_file" type="file"> <input type="submit" value="Upload"> </form>
BDL form:
"anyname" := "anyvalue", "filename" := "my_file;C:\\test.txt;plain/text";
WebAPI.bdh
WebPageSubmitFileUpload( in sHtmlForm : string allownull, in formSubmit : form, in sTimer : string optional, in nFormNo : number optional, in sFrame : string optional, in hContext : number optional) : boolean;
true if successful
false otherwise
Parameter | Description |
---|---|
sHtmlForm | The name of the HTML form to search for in the currently active Web page, or if the hContext parameter is not omitted in the specified context. Set this parameter to NULL if a name is not available or if you want to identify the HTML form only by its number. |
formSubmit | Form identifier used in the dclform section. The expanded form is added to the body of the request. The Content-Length is added automatically. The Content-Type is multipart/form-data. |
sTimer | Name of the timer used for page measurements (optional). If this parameter is omitted, no measurements are performed. |
nHtmlFormNo | Number of the Web form in the Web page (optional). If sHtmlForm is NULL, the number specifies the n-th form in the page. If sHtmlForm specifies a name, the number specifies the n-th form with the given name. |
sFrame | The name of the frame the document is assigned to (optional). If this parameter is provided, the form is searched only within this frame document. |
hContext | Context, stored by a prior call of the WebPageStoreContext function, where to search for the form (optional). If this parameter is omitted the form is searched in the actual page and all stored contexts. |
dcltrans transaction TWebPageSubmitFileUpload begin WebPageUrl("http://lab1/", "Test Site"); WebPageLink("File Upload Samples", "Form-based File Upload "); WebPageSubmitFileUpload("uploadform", FILE_UPLOAD_FORM, "File Upload Results"); end TWebPageSubmitFileUpload; dclform FILE_UPLOAD_FORM: "anyname" := "anyvalue", "filename" := "my_file;C:\\temp\\test.doc;application/msword";