AppUpload Method (CLIENT)
PLB Web Only, 9.9
The AppUpload method transfers a file from the client application to the PWS server. The method uses the following format:
|
|
|
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
object
Required. A CLIENT object.
return
Optional. A Numeric Variable that returns the success or failure of the method.
url
Required. A Character String Variable or string literal giving the URL of the file to upload from the PWS server.
filename
Required. A Character String Variable or string literal giving the file name to use on the server.
options
Optional. A Character String Variable or string literal that specifies a JSON object that is passed directly to the Cordova routine used for this method.
Flags Affected: OVER, ZERO
Note the following:
This method is only used for a Sunbelt PL/B Web Client App using Cordova\PhoneGap operations. See the following link for details on the Cordova plugin used:
https://www.npmjs.com/package/cordova-plugin-file-transfer
The ZERO flag is set when the {return} value is zero.
The OVER flag is set if the value returned is too large to be stored into the {return} variable.
The (options} parameter is passed directly as a JSON object to the Cordova routine. This currently only supports mimeType field as follows:
|
Field |
Description |
|
mimeType |
The mime type of the data to upload. Defaults to image/jpeg` mime type. |
This method starts an asynchronous upload of a file from the client to the PWS server. A result is generated using the PLB 'AppEventDoUpload' CLIENT object event with the event data being returned in ARG1 in JSON notation.
The event number used in EVENTREG is:
The event data returned by this method can be either a FileTransferError Object or a FileUploadResult JSON object returned in the ARG1 parameter.
FileUploadResult JSON object fields defined as follows:
|
Field |
Description |
|
code |
One of the predefined error codes listed below:
FILE_NOT_FOUND_ERR EQU 1 INVALID_URL_ERR EQU 2 CONNECTION_ERR EQU 3 ABORT_ERR EQU 4 NOT_MODIFIED_ERR EQU 5 |
|
responseCode |
The HTTP response code returned by the server. |
|
response |
The HTTP response returned by the server. |
Example Code
See Also: CLIENT, Client Methods, Method Syntax
![]() |