none
用javascript方式做skydrive接口开发,如何做上传下载功能? RRS feed

  • 问题

  • function downloadFile_onClick() { var picker = setupSavePicker(); picker.pickSaveFileAsync().then( function (file) { if (file && (file instanceof Windows.Storage.StorageFile)) { WL.backgroundDownload({ path: "file.8c8ce076ca27823f.8C8CE076CA27823F!129/picture?type=thumbnail", file_output: file }).then( function (response) { document.getElementById("infoLabel").innerText = "Downloaded file."; }, function (responseFailed) { document.getElementById("infoLabel").innerText = "Error calling API: " + responseFailed.error.message; } ); } else { document.getElementById("infoLabel").innerText = "Cannot download file."; } }, function (fileFailed) { document.getElementById("infoLabel").innerText = "Cannot download file."; } ); } function setupSavePicker() { var savepicker = new Windows.Storage.Pickers.FileSavePicker(); savepicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.documentsLibrary; savepicker.fileTypeChoices.insert("Picture", [".jpg"]); return savepicker; }

    上面是官网API的例子,但是运行的时候报错 "Windows未定义",不知怎么解决,上传下载功能如何实现呢?求帮助,谢谢

    2012年8月10日 7:00