简体   繁体   English

OneDrive Saver Api(上传多个文件)

[英]OneDrive Saver Api (Multiple Files Upload)

 var MyFiles = [];
  if (val == "Address") {
                        MyFiles.push({ 'file': 'http://----/Content/File/Addresses.xlsx', 'fileName': 'Addresses.xlsx' });
                    }
                    if (val == "DebitDetail") {
                        MyFiles.push({ 'file': 'http://----/Content/File/DebitDetails.xlsx', 'fileName': 'DebitDetails.xlsx' });
                    }
                    if (val == "AddressAssociated") {
                        MyFiles.push({ 'file': 'http://----/Content/File/AddressAssociatedCompanies.xlsx', 'fileName': 'AddressAssociatedCompanies.xlsx' });
                    }
                    if (val == "DebitDetailAssociated") {
                        MyFiles.push({ 'file': 'http://----/Content/File/DebitDetailsAssociatedCompanies.xlsx', 'fileName': 'DebitDetailsAssociatedCompanies.xlsx' });
                    }



  var saverOptions = {
            file: myFiles,
            success: function () {
                // upload is complete
            },
            progress: function (p) {
                // upload is progressing
            },
            cancel: function () {
                // upload was cancelled
            },
            error: function (e) {
                // an error occured
            }
        };

        OneDrive.save(saverOptions);

I have used the above code for DropBox and it works well because it takes an array of objects but i cant find solution for OneDrive.com! 我已经将上述代码用于DropBox,并且效果很好,因为它需要一组对象,但是我找不到OneDrive.com的解决方案! Below documentation only shows how to upload a single file using URL. 以下文档仅显示如何使用URL上传单个文件。 but i want to upload multiple files. 但我想上传多个文件。

The Format From The OneDrive Site 来自OneDrive网站的格式

var saverOptions = {
  file: "inputFile",
  fileName: 'file.txt',
  success: function(){
    // upload is complete
  },
  progress: function(p) {
    // upload is progressing
  },
  cancel: function(){
    // upload was cancelled
  },
  error: function(e) {
    // an error occured
  }
}

https://dev.onedrive.com/sdk/javascript-picker-saver.htm https://dev.onedrive.com/sdk/javascript-picker-saver.htm

Currently the OneDrive Saver only lets you upload one file at a time. 当前,OneDrive Saver仅允许您一次上传一个文件。 Depending on the type of app you're writing, it may be an option to go directly to the OneDrive API. 根据您正在编写的应用程序类型,可以选择直接转到OneDrive API。 Here's info about uploading files with the API . 以下是有关使用API​​上传文件的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM