You can still copy it old school way: Read file content!
getFile: function (filePath) {
var deferred = jQuery.Deferred();
var req = jQuery.ajax({
url: filePath,
type: "GET",
cache: false
}).done(function (fileContents) {
if (fileContents !== undefined && fileContents.length > 0) {
deferred.resolve(fileContents);
} else {
deferred.reject('Failed to read file from web..');
}
}).fail(function (jqXHR, textStatus) {
deferred.reject("Request for web file failed: " + textStatus);
});
return deferred.promise();
},
uploadFileToHost: function (filePath, destinationPath, fileName) {
var deferred = jQuery.Deferred();
getFile(filePath).then(
function (contents) {
var context = file.context
var createInfo = new SP.FileCreationInformation();
createInfo.set_content(new SP.Base64EncodedByteArray());
for (var i = 0; i < contents.length; i++) {
createInfo.get_content().append(contents.charCodeAt(i));
}
createInfo.set_overwrite(true);
createInfo.set_url(destinationPath+fileName);
var files = context.get_web().getFolderByServerRelativeUrl(destinationPath).get_files();
context.load(files);
files.add(createInfo);
context.executeQueryAsync(
function () {
deferred.resolve();
},
function (sender, args) {
deferred.reject(args.get_message());
});
},
function (err) {
deferred.reject(err);
}
);
deferred.done(function () {
Helper.logMessage("Uploaded to Host : " + file.destinationFileName);
});
deferred.fail(function (error) {
Helper.logMessage("Failed to uploaded to Host : '" + file.destinationFileName + "'. Error : " + error);
});
return deferred.promise();
},