【问题标题】:fineuploader server side renaming the file before the put methodFineuploader 服务器端在 put 方法之前重命名文件
【发布时间】:2016-04-06 09:28:57
【问题描述】:

刚开始测试 FineUploader,我想知道:

当 FineUploader 将文件直接上传到 azure 上的 blob 容器时, 我看到了文件(guid 名称而不是原始名称)。

是否有任何选项可以在服务器端设置文件名和保存文件的完整路径?

【问题讨论】:

标签: azure fine-uploader


【解决方案1】:

是的,您可以在通过 ajax 调用从服务器上传文件之前检索任何文件的名称,并利用 blobProperties.name option 允许返回值这一事实将其提供给 Fine Uploader Azure。例如:

new qq.azure.FineUploader({
   blobProperties: {
      name: function(fileId) {
         return new Promise(function(resolve) {
            // retrieve file name for this file from your server...
            resolve(filenameFromServer)
         })
      }
   },
   // all other options here...
})

在发送第一个请求之前,Fine Uploader Azure 将对每个文件调用一次上述选项。这适用于分块和非分块上传。传入resolve 的值将用作关联文件的新文件名。

【讨论】:

  • 这正是缺少的部分(在 asp webapi 服务器上)。如果文件直接上传到容器中。我有 2 种方法 1:用于 sas 和 2:用于成功......处理直接上传的最佳方法是什么?
  • public HttpResponseMessage Get(string bloburi, string _method) { var accountAndKey = new StorageCredentials("xxx", "xxx"); var sas = GetSasForBlob(accountAndKey, bloburi, _method); var content = new StringContent(sas);返回新的 HttpResponseMessage { 内容 = 内容 }; }
猜你喜欢
  • 2014-12-19
  • 2011-11-13
  • 2016-01-03
  • 1970-01-01
  • 1970-01-01
  • 2012-01-04
  • 2012-02-18
  • 2014-06-11
相关资源
最近更新 更多