I was wondering if anyone had any examples using AngularJS + NgFileUpload and a @RemoteAction
that handles base64 encoded file-data to create a drag & drop uploader?
I have JS handler that works with base64 encoded data
JS Handler:
var remoteUploadHandler = function(attachmentBody) {
MyController.fileUploader(attachmentName, attachmentBody,
function(result, event) {
console.log(result);
if (event.type === 'exception') {
console.log("exception");
console.log(event);
} else if (event.status) {
if (result.substring(0, 3) == '00P') {
if (doneUploading == true) {
Console.log('Done uploading');
} else {
positionIndex += chunkSize;
uploadAttachment(result);
}
}
} else {
console.log(event.message);
}
}, {
buffer: true,
escape: true,
timeout: 120000
});
};
Controller:
@RemoteAction
global static String fileUploader(String fileName, String base64BlobValue){
try{
System.debug('Filename: '+fileName+' Blob: '+base64BlobValue);
return 'Upload Successful';
} catch(exception e){
return e.getMessage();
}
}
But I want to convert it to D&D and use some of the methods in NgFileUpload, but their example:
http://jsfiddle.net/danialfarid/0mz6ff9o/135/, uses a traditional form-post.