Maybe this link on stackoverflow will help?
Get files in base64 code
Hi. I want to send any type of file via filereader from javascript to laravel backend. I use following code at javascript side.
var fileReader = new FileReader();
fileReader.onload = ( function () {
filesToUpload.push({ id : index, fileData : fileReader.result });
});
fileReader.readAsDataURL(value);
I can send data in base64 format but I don't know how can I save this data at laravel side. Could someone give an example. Thank you.
@NIKOS - I updated my code into
filesToUpload = [];
$.each(event.target.files, function(index, file){
filesToUpload.push(file);
}
then I append this fileToUpload Array into form data :
if (filesToUpload) {
formDatas.append('cadNames', filesToUpload);
}
When I get that cadNames with $request in controller :
if ($request->get("cadNames")) {
return $request->get('cadNames');
}
I get following response :
["[object File],[object File]"] 0: "[object File],[object File]" length: 1 proto: Array(0)
Please or to participate in this conversation.