filepicker网址与S3 [英] filepicker urls with s3

查看:124
本文介绍了filepicker网址与S3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望建立一个照片管理应用程序,我已经决定使用Filepicker.io与亚马逊S3来管理上传/托管静态文件。我计划有Filepicker处理图像的上传到S3,然后我将存储图像的URL的数据库 - 这些URL将被嵌入的模板。例如,

HTML:

 <输入类型=文件名称=数据文件>
  {{#如果SRC}}
  &所述; IMG SRC ={{的src}}'>
  {{/如果}}
 

JavaScript的:

 变更输入:功能(E,T){

      var文件= e.currentTarget.files [0];
      如果(文件){
        filepicker.store(文件,函数(FP){
          //设置网址FPURL
        },功能(错误){
          的console.log('错误',错误);
        },功能(进度){
          的console.log('装',进度);
        });
      }

    }
 

我的问题:它是更好地存储filepicker URL数据库?或者我应该保存 URL,它可以直接链接到S3?

我的f​​ilePicker成功的对象是这样的:

  {URL:https://www.filepicker.io/api/file/wppeyWAUQaaX0HPgXQ
大小:76511,类型:图像/ PNG,
键:EdqmSpbDQziIvSfI4g_logo.png
文件名:为Logo.png}
 

解决方案

我们建议您直接存储网址,因为这样你可以采取的 等功能,我们提供的URL上面的转换功能。另外,你不必惹直接S3 API和可以执行GET和对URL的POST而不是

I'm looking to build a photo management app and I've decided to use Filepicker.io with Amazon s3 to manage the uploads/hosting of static files. I plan on having Filepicker handle the upload of images to s3, and then I will store the url of the image in a database -- these urls will be embedded in a template. For example,

HTML:

<input type="file" name="datafile">
  {{#if src}}
  <img src='{{src}}'>
  {{/if}}

Javascript :

'change input' : function (e, t) {

      var file = e.currentTarget.files[0];
      if (file) {
        filepicker.store(file, function(fp){
          // Set URL to fpURL 
        }, function(err){
          console.log('error', err);
        }, function(progress){
          console.log('loading', progress);
        });
      }

    }

My question: Is it better to store the filepicker url in the database? Or should I be saving the key url, which can link directly to s3?

My filePicker success object looks like this:

{url: "https://www.filepicker.io/api/file/wppeyWAUQaaX0HPgXQ", 
size: 76511, type: "image/png", 
key: "EdqmSpbDQziIvSfI4g_logo.png", 
filename: "logo.png"}

解决方案

We recommend storing the URL directly, as that way you can take advantage of the conversion features and other functionality we provide on top of the URLs. Plus, you don't have to mess with the S3 APIs directly and can perform GETs and POSTs on the url instead

这篇关于filepicker网址与S3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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