如何在Swisscom Application Cloud上提供用户上传的文件? [英] How to serve user-uploaded files on Swisscom Application Cloud?

查看:75
本文介绍了如何在Swisscom Application Cloud上提供用户上传的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于应用程序不应将文件写入本地文件系统,因此将用户上传的文件存储在动态存储,由Swisscom提供.

As applications shouldn't write files to the local file system it makes sense to store user-uploaded files in the Dynamic Storage provided by Swisscom.

动态存储服务类似于Amazon S3,您通常会使用

The Dynamic Storage service is similar to Amazon S3 where you would usually make the bucket with the user-uploaded files publicly readable with a bucket policy.

但是,我如何将动态存储中的用户上传文件作为放置存储桶策略"提供不受支持的操作?

However how would I serve user-uploaded files from the Dynamic Storage as the "Put Bucket policy" is an unsupported operation?

推荐答案

您是正确的,Swisscom的动态存储不支持"PUT桶策略"操作.但是,您可以通过生成预先签名的URL将文件直接提供给用户.

You are correct, dynamic storage of Swisscom does not support the „PUT bucket policy" operation. But you can serve files directly to the user by generating pre-signed URLs.

请参见与他人共享对象

默认情况下,所有对象都是私有的.只有对象所有者具有 访问这些对象的权限.但是,对象所有者可以 通过创建一个预签名的URL,可以选择与他人共享对象, 使用自己的安全凭证来授予限时权限 下载对象.

All objects by default are private. Only the object owner has permission to access these objects. However, the object owner can optionally share objects with others by creating a pre-signed URL, using their own security credentials, to grant time-limited permission to download the objects.

为对象创建预签名URL时,必须提供 您的安全凭证,指定存储桶名称,对象密钥, 指定HTTP方法(获取下载对象的GET方法)和到期时间 日期和时间.预先签名的URL仅对指定的URL有效 持续时间.

When you create a pre-signed URL for your object, you must provide your security credentials, specify a bucket name, an object key, specify the HTTP method (GET to download the object) and expiration date and time. The pre-signed URLs are valid only for the specified duration.

任何接收到预签名URL的人都可以访问该对象.为了 例如,如果您的存储桶中有一个视频,并且存储桶和 该对象是私有对象,您可以通过以下方式与他人共享视频 生成一个预签名的URL.

Anyone who receives the pre-signed URL can then access the object. For example, if you have a video in your bucket and both the bucket and the object are private, you can share the video with others by generating a pre-signed URL.

通过使用预签名的URL,您必须定义URL的有效期限.我们建议选择对特定用例有意义的到期日期.

By using a pre-signed URL you have to define how long the URL shall be valid. We recommend to choose an expiration date that makes sense for the specific use-case.

信息:当前,S3存储由 Atmos

Info: currently the S3 storage is powered by Atmos

这篇关于如何在Swisscom Application Cloud上提供用户上传的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆