直接从Google Drive上传到Amazon S3 [英] direct upload from google drive to amazon s3

查看:174
本文介绍了直接从Google Drive上传到Amazon S3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Web应用程序中有一个有效的上传表单,该表单可让用户从其计算机上载文件. 该文件直接上传到Amazon s3,而无需先通过我的服务器

I have a working upload form in my webapp that lets user upload files from their computer. The file is uploaded directly to amazon s3 without going through my server first

这是我的表单的样子,我使用jquery文件上传插件.

this is how my form looks like, and Im using jquery file upload plugin.

    <form class="startfileupload" action="//s3-us-west-2.amazonaws.com/<?php echo AMAZON_S3_BUCKET ?>/" method="POST" enctype="multipart/form-data" >
        <input type="hidden" name="key" value="<?php echo $file_name;?>" >
        <input type="hidden" name="AWSAccessKeyId" value="<?php echo AMAZON_KEY ?>">
        <input type="hidden" name="acl" value="private">
        <input type="hidden" name="policy" value="<?php echo $aws['base64Policy']; ?>">
        <input type="hidden" name="signature" value="<?php echo $aws['signature']; ?>">
        <input id="uploadinput" type="file" accept=".xls,.xlsx,.doc,.docx,.ppt,.pptx,.jpg,.jpeg,.png,.bmp,
            .pdf, .zip" name="file" multiple=""/>

我想为用户提供选项,使用户可以使用Google Play选择器中的驱动器API从其google驱动器中选择文件.

I want to give users the option for users to choose files from their google drive, using the drive api I added the google picker which lets user pick files from there.

在他们选择了文件之后,我在回调中获取了文件元数据(包括文件url).

after they pick the file, I get in the callback the file metadata (including a file url).

如何使用该文件将文件直接上传到s3?

How can I use that to upload the file directly to s3?

我不想将文件上传到服务器,然后将其复制到s3,我想直接将文件上传到s3.不需要在客户端下载文件然后上传它,这是否可行?

I dont want to upload the file to my server and then copy it to s3, I want to upload the file dircetly to s3. Is that poosible without having to download the file on client side and then upload it?

Thx

推荐答案

将文件上传到S3的唯一方法是将 file 发送到S3.

The only way to upload a file to S3 is to send the file to S3.

S3无法从外部URL获取对象.

S3 does not have the capability to fetch an object from an external URL.

直接从Google下载到服务器,然后再上传到S3,或者您可以使用通过AWS API Gateway调用的AWS Lambda在后台(同步或异步)处理实际的下载/上传传输.

Download to your server directly from Google and then upload to S3, or you could use AWS Lambda invoked through AWS API Gateway to handle the actual download/upload transfer in the background (sync or async).

这篇关于直接从Google Drive上传到Amazon S3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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