javascript-将文件上传到skydrive [英] javascript - upload files to skydrive

查看:75
本文介绍了javascript-将文件上传到skydrive的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要一些帮助.我正在尝试通过Javascript将文件上传到SkyDrive,但是遇到一些问题.我正在使用此链接提供的代码 http://msdn.microsoft .com/en-us/library/live/hh550848.aspx .但是我似乎无法使其正常工作.

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?

将其上传到SkyDrive上公用"文件夹的正确路径是什么?以及如何解决登录错误?请帮助.

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.

推荐答案

您将需要先启动Live SDK.

You will need to initiate the Live SDK first.

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

有关如何登录用户的链接: http://msdn.microsoft .com/en-us/library/dn631820.aspx

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

这篇关于javascript-将文件上传到skydrive的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆