Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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)

...

  1. 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.

  2. 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.

  3. 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
AWSAccessKeyId
bucket
Content-Disposition
Content-Type
key
policy
signature
x-amz-server-side-encryption
x-amz-credential
x-amz-date
x-amz-algorithm
x-amz-signature
success_action_status

'private'
SDriveTools.getAccessKey()
SDriveTools.getBucketName()
'attachment; filename=\"'+  uploadRequestInfosuploadRequestInfos.fileName+'\"'
uploadRequestInfos.fileType
uploadRequestInfos.fileLocation
uploadRequestInfos.policy
'AES256'
uploadRequestInfos.awsCredential
uploadRequestInfos.signaturetimeStamp
'AES256'AWS4-HMAC-SHA256’
uploadRequestInfos.signature
201