File Upload

How to handle uploading of images and other file types

To upload a file (typically a photo) which can subsequently be attached to emails or returned to the host system, select 'File Upload' from the Question Type menu (if this option is not listed, please contact Support as this functionality may be disabled).

Example file upload question

Properties

Admin Display – a descriptive name to identify the Question.

Operator Display - the Question text as displayed to the Operator.

File Types – defines the permitted file types. This text is displayed to the end user. More information below...

Max Files - This option allows script authors to control how many files users can attach whilst completing the question. If the user attempts to upload more than the allowed max files a validation message will be presented informing users they cannot upload any more files.

Max File Size - This option allows script authors to control the maximum file size allowed for any individual file uploaded whilst completing the question. Any individual file uploaded must be below the "Max File Size" otherwise a validation message will be displayed informing the user the file is too big. This setting does not limit the total size of all combined files. For example, if you allow the user to upload 5 files and set a max file size of 10mb then the user can upload 5 10mb files for the question which would of course total 50mb on the server. If any individual upload exceeded 10mb then the file would be rejected, and the file is too big validation message would be displayed – other valid files would still be processed if you selected multiple files.

Record Value - if checked the value will be added to the recorded text.

Mandatory - check this box to make an upload mandatory.

More about File Types

The permitted file types will be displayed to the operator/end-user. You can specify the permitted file types in various ways...

  • 'jpg' and 'gif' and 'png' and 'docx' and 'mp4' and 'zip' and 'pdf'

  • jpg, gif, png, docx, mp4, zip, pdf

  • jpg,gif,png,docx,mp4,zip,pdf

  • .jpg, .gif, .png, .docx, .mp4, .zip, .pdf

  • .jpg,.gif,.png,.docx,.mp4,.zip,.pdf

  • .jpg,.gif,.png,.docx,mp4,zip,pdf

Setting sensible defaults

Although the File Types, Max Files & Max File Size can be customized on a per question basis it's also possible to set global defaults for these fields. These defaults will be used when creating new file upload questions or editing existing questions before these fields were introduced. For assistance with setting these defaults please contact support.

User Experience

Example File Upload question

Typically, the path(s) of the uploaded files can be subsequently used in (e.g.) email attachments or can be returned to the host system. As part of your initial implementation (or upgrade), Support can advise how to access the Filepaths and URLs that are available for use, either within Keyfax or when returned to the host.

Here, the path is written to a Databox:

Upload question writing the path to a Databox

...which can then be specified as an email attachment:

Email attachment

Housekeeping

WIth potentially large amounts of disc storage required for uploaded files, automatic housekeeping jobs will run every night in order to delete old files. The retention period is configurable; please Contact Us for assistance with customizing your upload retention period.

Export Uploads

Files uploaded during a Keyfax script are exposed within the Keyfax export XML / JSON for host systems to consume. Examples of the exposed upload results can be seen below.

NOTE The below example uses Keyfax Repair Diagnostics. The <Uploads/> element is exposed in a consistant manner for all Keyfax script types however the full XPath may be different depending on the script type. For example the <Fault> element would typically be replaced with a <Call> element for Keyfax Repairs Self Service.

Example XML

<?xml version="1.0" encoding="utf-8"?>
<KeyfaxData>
  <Fault name="Fault1" type="RD">
    <Uploads>
      <File name="Chair_-_Copy.JPG" type="image/jpeg" length="2059660" json:Array="true" xmlns:json="http://james.newtonking.com/projects/json">
        <![CDATA[https://keyfax.domain.com/InterView/Main/Uploads/?f=b11b7fdf-9d33-43a1-bb80-9ad4aba5eb95/Chair_-_Copy.JPG]]>
      </File>
      <File name="IMG_0003.MOV" type="video/quicktime" length="6115110" json:Array="true" xmlns:json="http://james.newtonking.com/projects/json">
        <![CDATA[https://keyfax.domain.com/InterView/Main/Uploads/?f=7f7e95f8-37f3-4586-bec0-d41ae3d092ad/IMG_0003.MOV]]>
      </File>
      <File name="IMG_0055_-_Copy.JPG" type="image/jpeg" length="1291112" json:Array="true" xmlns:json="http://james.newtonking.com/projects/json">
        <![CDATA[https://keyfax.domain.com/InterView/Main/Uploads/?f=e46e1fc7-fd63-4568-bc4d-63d6b135f774/IMG_0055_-_Copy.JPG]]>
      </File>
      <File name="IMG_0401.JPG" type="image/jpeg" length="962949" json:Array="true" xmlns:json="http://james.newtonking.com/projects/json">
        <![CDATA[https://keyfax.domain.com/InterView/Main/Uploads/?f=e23e98bd-549a-418e-bba1-cdb22e5ff980/IMG_0401.JPG]]>
      </File>
      <File name="Omfax_Social_MASTER.mp4" type="video/mp4" length="13745195" json:Array="true" xmlns:json="http://james.newtonking.com/projects/json">
        <![CDATA[https://keyfax.domain.com/InterView/Main/Uploads/?f=d6c78b87-ebbd-4557-978f-154d64068852/Omfax_Social_MASTER.mp4]]>
      </File>
    </Uploads>
 </Fault>
</KeyfaxData>

Example JSON

{
    "KeyfaxData": {
        "Fault": {
            "@name": "Fault1",
            "@type": "RD",          
            "Uploads": {
                "File": [
                    {
                        "@name": "Chair_-_Copy.JPG",
                        "@type": "image/jpeg",
                        "@length": "2059660",
                        "#cdata-section": "https://keyfax.domain.com/InterView/Main/Uploads/?f=b11b7fdf-9d33-43a1-bb80-9ad4aba5eb95/Chair_-_Copy.JPG"
                    },
                    {
                        "@name": "IMG_0003.MOV",
                        "@type": "video/quicktime",
                        "@length": "6115110",
                        "#cdata-section": "https://keyfax.domain.com/InterView/Main/Uploads/?f=7f7e95f8-37f3-4586-bec0-d41ae3d092ad/IMG_0003.MOV"
                    },
                    {
                        "@name": "IMG_0055_-_Copy.JPG",
                        "@type": "image/jpeg",
                        "@length": "1291112",
                        "#cdata-section": "https://keyfax.domain.com/InterView/Main/Uploads/?f=e46e1fc7-fd63-4568-bc4d-63d6b135f774/IMG_0055_-_Copy.JPG"
                    },
                    {
                        "@name": "IMG_0401.JPG",
                        "@type": "image/jpeg",
                        "@length": "962949",
                        "#cdata-section": "https://keyfax.domain.com/InterView/Main/Uploads/?f=e23e98bd-549a-418e-bba1-cdb22e5ff980/IMG_0401.JPG"
                    },
                    {
                        "@name": "Omfax_Social_MASTER.mp4",
                        "@type": "video/mp4",
                        "@length": "13745195",
                        "#cdata-section": "https://keyfax.domain.com/InterView/Main/Uploads/?f=d6c78b87-ebbd-4557-978f-154d64068852/Omfax_Social_MASTER.mp4"
                    }
                ]
            }
        }
    }
}

Security

Although we whitelist the file type extension (configurable above in the File Type definition), we do not interrogate the file content to confirm the content type or perform any other checks. This should be further secured with 3rd party AV scanning software running on the file server.

Last updated