Skip to main content

Uploading File using Credentials

The upload policy credentials JSON is used for uploading files to your VdoCipher account, using an HTTP POST request. You would create a form-data object containing the following keys received from the API server response in Step 1:

  • policy
  • x-amz-signature
  • x-amz-date
  • key
  • x-amz-algorithm
  • x-amz-credential

The request for upload credentials also returns the uploadLink URL, to which the API POST request is to be made. In addition to the above parameters, the following need to be added:

  • success_action_status - 201
  • success_action_redirect - Set this to empty string if you do not have a specific redirect page
  • file - This is the path to the file on your content provider's device. The file should always be appended to the end of the upload policy.

Upload File Sample Code​

The values to be input from the upload policy are entered in the following format - {{policy}}

curl -X POST \
'https://{s3-bucket-url}}' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-F 'policy={{policy}}' \
-F 'key={{key}}' \
-F 'x-amz-signature={{x-amz-signature}}' \
-F 'x-amz-algorithm={{x-amz-algorith}}' \
-F 'x-amz-date={{x-amz-date}}' \
-F 'x-amz-credential={{x-amz-credential}}' \
-F success_action_status=201 \
-F 'success_action_redirect='\'''\''' \
-F 'file=@fileDir/fileName.mp4'