在 javascript 中将图像直接上传到 AWS S3
Upload Images Direcly to AWS S3 in javascript
我正在开发一个上传图像和其他文件的网络应用程序regularly.I我正在使用 AWS Cognito 服务作为身份验证method.Uploading 使用 PHP SDK 对我不起作用,因为我使用 JavaScript 和 HTML5。谁能给我一个使用 Cognito 验证 AWS S3 并上传图像并在成功时检索上传图像预览的完整示例,使用 JavaScript.
你可以使用,AWS CloudFront Signed URLs with AWS PHP SDK to generate Signed URLs to perform the upload directly from Browser using AWS JavaScript SDK S3。
getSignedUrl ( string $url, string|integer|null $expires = null, string $policy = null )
涉及的流程来自浏览器,您将请求一个 url,带有到期时间,以允许将文件上传到存储桶。在对用户进行身份验证后,您可以使用本示例中给出的 PHP 后端和 AWS SDK 编写 Sign url 创建。
使用 Signed URL 和 AWS JavaScript SDK for S3,浏览器可以直接将文件上传到 S3。
有关已签名 URL 的详细信息,请查看 Signed URLs Work。
谢谢大家,我在这个 link 中找到了正确答案。
http://www.tothenew.com/blog/aws-s3-file-upload-with-progress-bar-using-javascript-sdk/
我正在开发一个上传图像和其他文件的网络应用程序regularly.I我正在使用 AWS Cognito 服务作为身份验证method.Uploading 使用 PHP SDK 对我不起作用,因为我使用 JavaScript 和 HTML5。谁能给我一个使用 Cognito 验证 AWS S3 并上传图像并在成功时检索上传图像预览的完整示例,使用 JavaScript.
你可以使用,AWS CloudFront Signed URLs with AWS PHP SDK to generate Signed URLs to perform the upload directly from Browser using AWS JavaScript SDK S3。
getSignedUrl ( string $url, string|integer|null $expires = null, string $policy = null )
涉及的流程来自浏览器,您将请求一个 url,带有到期时间,以允许将文件上传到存储桶。在对用户进行身份验证后,您可以使用本示例中给出的 PHP 后端和 AWS SDK 编写 Sign url 创建。
使用 Signed URL 和 AWS JavaScript SDK for S3,浏览器可以直接将文件上传到 S3。
有关已签名 URL 的详细信息,请查看 Signed URLs Work。
谢谢大家,我在这个 link 中找到了正确答案。
http://www.tothenew.com/blog/aws-s3-file-upload-with-progress-bar-using-javascript-sdk/