Uploadcare storages

There are two common ways to use storage in Uploadcare. The difference is in flexibility, complexity and the costs of third-party services.

1st workflow: our storage

  1. User uploads a file through our widget or any capable library.
  2. Uploadcare provides your app with temporary link.
  3. App requests Uploadcare to keep file permanently.
  4. Uploadcare serves file to your app's users from our CDN.
  5. If the file is image you can apply any CDN operations at anytime.

This way is more flexible and requires less settings. Traffic and file storage costs are included in your Uploadcare plan.

2nd workflow: your storage

  1. User uploads a file through our widget or any capable library.
  2. Uploadcare provides your app with temporary link.
  3. App requests Uploadcare to save file to one of preconfigured "storages".
  4. If the file is image app can request Uploadcare to save other versions of file with different operations applied.
  5. File can be served directly from your storage or from connected third-party CDN.

If you do not store file in our storage (like in 1st workflow) it is removed after 24 hours. Therefore you should copy all necessary formats soon after uploading.

For this workflow you need to connect custom storage in your dashboard. Traffic and storage costs are not included in your Uploadcare plan and depend on third-party services.

Storage setup

At first you need Amazon Web Services account. Then you need to create new or select existing bucket in S3 bucket management.

Select your project in Uploadcare dashboard, go to "Custom storage" page. Click "Connect S3 bucket" link to connect new storage to Uploadcare.

Storage is named set of settings. It includes name to identify your custom storage in API, S3 bucket name and prefix. You can use prefix to organize files inside your bucket. It will be added to each file name saved in this storage. You can have as many storages with same bucket and different prefixes as you need.

Copying files to storage

With temporary link provided by Uploadcare you can copy file to your storage through api request. In this request, source should be temporary link and target is storage name to save file to.

File will be copied to your bucket to path:

/<prefix>/<file_uuid>/<filename>

Where <filename> is part of provided link after last slash or original file name.

If file is image you can provide link with operations applied. In this case modified file name will be made from provided file name and operations. For example if you pass source like this:

http://www.ucarecdn.com/<file_uuid>/-/preview/200x200/roof.jpg

You will get file at path:

/<prefix>/<file_uuid>/roof.preview_200x200.jpg

Thus all versions of one file will be stored in the same virtual folder.

Copy method returns link to file with ad hoc scheme s3 in result member of response object. For example:

s3://my-bucket/<prefix>/<file_uuid>/roof.preview_200x200.jpg

In this scheme host is S3 bucket name and path is path to the file in bucket. If you want to serve files directly from S3 you can get http link to file by replacing s3:// to http://s3.amazonaws.com/.

If you haven't found what you were looking for in these docs, try looking in our Knowledge Base.