fineuploader服务器端在put方法之前重命名文件 [英] fineuploader server side renaming the file before the put method

查看:132
本文介绍了fineuploader服务器端在put方法之前重命名文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Just starting to test the FineUploader and I wonder:

当FineUploader将文件直接直接上传到Azure上的Blob容器时, 我看到了文件(引导名称而不是原始名称).

When FineUploader uploading files directly to a blob container on azure, I see the files (guid name instead of the original).

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

Is there any option to set on the server side the file name and the full path to save the file ?

推荐答案

是的,您可以在通过ajax调用从服务器上载任何文件之前检索任何文件的名称,并通过使用 blobProperties.name选项这样的事实期票的返回值.例如:

Yes, you can retrieve the name for any file before it is uploaded from your server via an ajax call and supply it to Fine Uploader Azure by making use of the fact that the blobProperties.name option allows for a promissory return value. For example:

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的值将用作关联文件的新文件名.

The above option will be called by Fine Uploader Azure once per file, just before the first request is sent. This is true of chunked and non-chunked uploads. The value passed into resolve will be used as the new file name for the associated file.

这篇关于fineuploader服务器端在put方法之前重命名文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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