I'm trying to upload a PDF file using jQuery. What I need to do is send a JSON in a POST body that contains the base64 of the PDF file, so that I can decode it & save it using PHP.
What I have is a html file input:
<input type="file" id="user_tc_file_path">
And what I'm trying to do is use the btoa()
function as shown:
let file = btoa($('#user_tc_file_path').prop('files')[0]);
But the variable "file" containes a very short string which, if decoded, reads
[object Object]
Can someone enlighten me as to what I'm doing wrong?
Thanks!