Cordova FIle Transfer plugin how to pass transloadit parameters?

妖精的绣舞 提交于 2019-12-12 03:31:06

问题


Update Trying to post the file to transloadit using the FileTransfer plugin using the following code

     var uri = encodeURI("https://api2-eu-west-1.transloadit.com/assemblies");
            var options = new FileUploadOptions();
            options.fileKey = "file";
            options.fileName = filepath.substr(filepath.lastIndexOf('/') + 1);

            var params = new Object();
            params.auth =new Object();
            params.auth.key ="***************" ;

            options.params = params; 
            var ft = new FileTransfer();
            ft.upload(filepath, uri, win, fail, options);

I get the error "no_params_field", "No Params Field Provided" I also tried passing params as options

    ft.upload(filepath, uri, win, fail, params);

Can you please help how to send the transloadit params with the FileTransfer plugin?

Thanks


回答1:


Found it , It should be passed as

    var params = {};
            params.params = new Object();
            params.params.auth = {key: "***"};

Then

    ft.upload(filepath, uri, win, fail, {params: params});

Thanks



来源:https://stackoverflow.com/questions/35902029/cordova-file-transfer-plugin-how-to-pass-transloadit-parameters

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