Uploads a file to the web server. This function implements a RFC1867-compliant file upload function for form-based file upload in HTML.
WebFileUploadEx automatically recognizes a multipart form and a file upload. When uploading a file during recording, the Silk Performer Recorder automatically scripts the respective function and the uploaded file is added to the data files.
"filename" := "<name of the input tag>;<file name>;<content type>";
WebAPI.bdh
WebFileUploadEx( in sUrl : string, formUrl : form, formBody : form, in fWait : double optional ): boolean;
true if the file is found and submitted successfully
false otherwise
Parameter | Description |
---|---|
sUrl | Complete URL to the file on the server |
formUrl | Form identifier used in the dclform section (see example below). The expanded form is added to the URL after the "?". |
formBody | Form identifier used in the dclform section (see example below). The expanded form is added to the body of the request. The Content-Length and Content-Type header are added automatically. |
fWait | Minimum time or minimum mean time that this function call has to last (optional). Default value is 0.0 |
The form content in the dclform section is represented in an unencoded format to enhance readability and customizability. The data gets URL encoded on file upload. There are two possibilities to send data unencoded:
dcltrans transaction TWebFileUpload begin WebFileUploadEx("http://standardhost/data2html.asp", URL_FORM, FILE_UPLOAD_FORM); end TWebFileUpload; dclform URL_FORM: "ID" := "1234"; FILE_UPLOAD_FORM: "anyname" := "anyvalue", "filename" := "my_file;C:\\temp\\test.doc;application/msword";