fineuploader server side renaming the file before the put method

泄露秘密 提交于 2019-12-12 02:53:54

问题


Just starting to test the FineUploader and I wonder:

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 ?


回答1:


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...
})

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.



来源:https://stackoverflow.com/questions/36446982/fineuploader-server-side-renaming-the-file-before-the-put-method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!