pui.uploadSignature( config )



This API uploads the contents of a signature pad widget to a file in the IFS on your server running IBM i. 

The security for this API is managed through the File Upload Exit Program (PUIUPLEXIT), and you will not be able to upload signatures until that exit program has been set up.  You can learn how to do that on the File Upload Security Page.

Parameters:

  • config object - JavaScript object containing configuration properties

Configuration Options

  • signaturePadId - the id of the signature pad widget to extract the image from

  • dir - the IFS directory to upload the image to; if not specified, the image is uploaded to /www/profoundui/htdocs/profoundui/userdata/images

  • fileName - the IFS file name for the image; the default value is "signature.png"

  • imageType (optional) - type of image to create.  it may be "image/jpeg" or "image/png".  If not given, "image/png" is the default.

  • overwrite (optional) - true or false value specifying whether the image file should be overwritten if it already exists; the default value is false

  • handler - JavaScript function to handle the result of the operation; if not provided, nothing will happen on success, and an error message will be alerted on failure; the function will receive a configuration object with the following properties:

    • success - true or false value indicating whether the photo was captured and uploaded successfully

    • error - error message; present only if success is false

Example:

The following example uploads the contents of a signature pad widget that has an id of "SignaturePad1":

pui.uploadSignature({ "signaturePadId": "SignaturePad1",  "dir": "/www/profoundui/htdocs/signatures", "imageType": "image/jpeg",  "fileName": "driverSignature.jpg", "overwrite": true, "handler": function(success, errorMsg) { if (success) { pui.click(); } else { alert(errorMsg); } } });