1
votes

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

1 Answers

0
votes

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