Hello,

I need to create a client application that uploads a file or files to Skydrive, but also measures the latency of each file upload. The app must receive as parameter a folder from the skydrive and have the files written sequentially.

I have the basic code but I have no idea what to do after this. Please help, i'm lost.

CODE:

WL.init({ client_id: clientId, redirect_uri: redirectUri });

WL.login({ "scope": "wl.skydrive_update" }).then(
function(response) {
displayDialog();
registerOnClickHandlers();
},
function(response) {
log("Failed to authenticate.");
}
);

function registerOnClickHandlers() {
var uploadFileButton =
document.getElementById('save-to-skydrive-upload-button');
uploadFileButton.disabled = true;
uploadFileButton.onclick = function() {
closeDialog();
saveToSkyDrive();
};

var fileInputElement =
document.getElementById('save-to-skydrive-file-input');
fileInputElement.onchange = function() {
uploadFileButton.disabled = (fileInputElement.value === "");
};
}

function saveToSkyDrive() {
WL.fileDialog({ mode: 'save' }).then(
function(response) {
var folder = response.data.folders[0];

WL.upload({
path: folder.id,
element: 'save-to-skydrive-file-input',
overwrite: 'rename'
}).then(
function(response) {
log("You saved to " + response.source + ". " +
"Below is the result of the upload.");
log("");
log(JSON.stringify(response));
},
function(errorResponse) {
log("WL.upload errorResponse = " + JSON.stringify(errorResponse));
},
function(progress) {
// progress events for the upload are raised here
}
);
}, function(errorResponse) {
log("WL.fileDialog errorResponse = " + JSON.stringify(errorResponse));
}
);
}

function log(message) {
var child = document.createTextNode(message);
var parent = document.getElementById('JsOutputDiv') || document.body;
parent.appendChild(child);
parent.appendChild(document.createElement("br"));
}