The fileUpload component provides your users with the ability to attach files. For example, if your event registration requires a photo from your guest, your guest would be able to attach a jpeg to their registration.
To instantiate your fileUpload component, use the below code example.
Each file is stored in a private Amazon S3 bucket. When the file is uploaded, Salesforce creates a timed link for you to view the file. You can override this functionality.
To Configure the Time Limit for the File's URL
From the Spark Admin page:
[Click] the AWS S3 Configuration link under Settings Pages.
[Enter] the Upload TTL and Download TTL. These Time to Live values are entered in seconds. The minimum is 10 seconds, and there is no maximum.
[Click] .
Configurable Attributes
Fonteva allows you to customize your fileUpload component via otherAttributes. For example, in the above code block, the maximumFileSize and allowedMimeTypes are specified. In the example below, the viewport, along with the cropped file size and allowed mime types, are indicated.
Here is an example of the otherAttributes available for this component.
maximumFileSize - The maximum allowed file size in bytes.
allowedMimeTypes - You can provide specific file types. If you do not provide a list of accepted file types, users are allowed to upload any type of file.
viewport - The part of the image displayed. You can specify the height and width, along with the shape of the viewport.
cropppingResultParams - You can customize the result of the cropped image. You can specify the file type, the size of the image, and the type.
allowCropping - Setting this attribute to "true" enables cropping
additionalModalClass - You can provide custom CSS classes for the image cropping modal.
showPreview - Setting this attribute to "true" displays a preview next to the fileUpload field.
previewWidth & previewHeight - The height and width of the preview above.
Fonteva recommends the size specified in croppingResultParams and viewport match. If the two size attributes do not match, it will result in a skewed image.
Below is a rendered example of fileUpload component:
JavaScript errors detected
Please note, these errors can depend on your browser setup.
If this problem persists, please contact our support.