File Uploader

VGS Collect provides an interface for collecting and sending file data to VGS. You can add a file uploading functionality to your application with VGSFilePickerController.

VGSFilePickerController

An object you use to import files from VGSFileSource.

Declaration

class VGSFilePickerController

Creating a VGSFilePickerController

required init(configuration: VGSFilePickerConfiguration)

• You can to select and send only one file at a time. • You should always create strong referrence for VGSFilePickerController instance inside your UIViewController.

VGSFilePickerController Attributes and Methods

/// Handle VGSFilePickerController states
var delegate: VGSFilePickerControllerDelegate?

/// Present File Picker object on a *UIViewController*
func presentFilePicker(on viewController: UIViewController, animated: Bool, completion: (() -> Void)? = nil)

/// Dismiss File Picker from a *UIViewController*
func dismissFilePicker(animated: Bool, completion: (() -> Void)? = nil)

VGSFilePickerControllerDelegate

Declaration

Managing Controller States

• When picked file is valid, it will be stored in VGSCollect storage. • VGSFileInfo contains optional file metadata info. SDK don't validate file metadata info.\

VGSFileSource

Type of file source

VGSFileSource

Description

.camera

Device camera

.photoLibrary

Device photoLibrary

.documentsDirectory

Device files directory

Send File

You should useVGSCollect object functions to send file data to your organization's vault.

Errors can be returned in the NSURLErrorDomain and VGSCollectSDKErrorDomain. You will receive VGSError on sendFile(_:) request if the input file data is not supported or doesn't meet the size limits. For more details, check SDK Reference Docsarrow-up-right.

Remove file from VGSCollect storage.

After the file is selected by the user, it will be stored in the App memory and connected to VGSCollect storage instance. It's your responsibility to detach the file from the VGSCollect instance after sending the file. Use vgsCollect.cleanFiles() to detach files whenever you need.

• Only file data and extraData will be sent to VGS on vgsCollect.sendFile(_:). If you need to send data from VGSTextField use vgsCollect.sendData(_:) instead. • The max file size that can be send to VGS is 24 Mb. You will get specific VGSError when file size exceeds the limit.\

Usage

Send data to your organization's vault

Asynchronously send the file attached to the VGSCollect instance to your organization's vault using the Combine framework.

Send the file attached to the VGSCollect instance to your organization's vault using the Combine framework.

Handle VGSFilePickerController states with VGSFilePickerControllerDelegate.

Last updated