This method is used to initialize attachment uploads.
Info |
---|
Refer to Uploading Files to S-Drive (Amazon S3) for comprehensive instructions on how to upload files using SDriveTools API. |
List<UploadRequestInfo> initializeUpload
(String objectId, List<SObject> attachments, Map<String,String> policyMap)
Parameters:
objectId: Id of the parent object. You can use 15-character or 18-character Salesforce.com id. For example, this ID is the ID of the case record if the attachments are being uploaded for a case.
attachments:List of Salesforce SObject for uploading. The SObject will be representing the "File" object. For example, for a Case attachment, the SObject will be representing the cg_CaseFile_c record.
policyMap: Map of policy conditions and theirs values that represent the additional policy parameters used during upload (e.g. ('$Content-Disposition', 'attachment; filename)). For more information, visit the Amazon documentation:
http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html
Return Value: The method will return the list of UploadRequestInfo (Figure 7see table below), which holds information about the files that are about to be uploaded.
...
It is required to set SObject’s File_Name__c, File_Size_in_Bytes__c and Parent__c
fields. You can optionally set other custom fields.For S-Drive Attachments files, Parent__c refers to its parent object id. In order to set
the parent folder id, use Parent_Folder_Id__c field. For S-Drive Folders files,
Parent__c refers to its parent folder id and if you want to upload the file to home
folder set this to null. Also for S-Drive Folders files, objectId must to be set to null.If you put expiration, acl, bucket, key and x-amz-server-side-encryption conditions in
the policyMap, these parameters will be ignored. Because, these are being set in the
initializeUpload () method. You do not need to put these parameters in the
policyMap. But, you must use these parameters while uploading.
Form Field | Value |
acl | 'private' |