I\'m trying to create a file upload system implementing client side encryption using CryptoJS.
The problem I\'m having is that execution of the script is stopped by
The issue is that CryptoJS
functions return objects not strings, so you have to stringify it before you attempt to send it.
var jqxhr = $.ajax({
url: "/api/files/upload",
type: "POST",
data: {
'name': fname,
'data': fdata.toString(),
'key': skey.toString()
}
});
http://jsfiddle.net/wob66Lc0/1/
Also encryption works on bytes not text so you should read the file as a binary string instead of text
fr.readAsBinaryString(input.files[0]);