javascript - upload files to skydrive

孤人 提交于 2019-12-24 13:45:16

问题


Need some help. I'm trying to upload files to SkyDrive by Javascript but I'm encountering some problems. I'm using the code provided by this link http://msdn.microsoft.com/en-us/library/live/hh550848.aspx. But I can't seem to make it work.

$('#btnSample').click(function (e) {

        WL.login({
            scope: "wl.skydrive_update"
        }).then(
        function (response) {
            WL.upload({
                path: "me/Public",
                element: "file"
            }).then(
                function (response) {
                    alert('FILE UPLOADED');
                },
                function (responseFailed) {

                    alert("Error uploading file: " + responseFailed.error.message);
                }
            );
        },
        function (responseFailed) {

            alert("Error signing in: " + responseFailed.error.message);
        }
    );
    }); //btnSample

After clicking, the alert box will pop out and will show the "Error signing in: undefined" message. At first I think it's on my path, but I think it's on my log in, right?

What is the correct path for me to upload it on my Public folder on SkyDrive? And how to fix the error in signing in? Help please.


回答1:


You will need to initiate the Live SDK first.

WL.init({ scope: "wl.signin" });

A link on how to sign users in: http://msdn.microsoft.com/en-us/library/dn631820.aspx



来源:https://stackoverflow.com/questions/18715813/javascript-upload-files-to-skydrive

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