I want to upload and download the files using javascript.
Step 1: I converted the uploaded files to binary code and successfully able to send the binary code to server through web api.
var SA_Supp_Evidence_Object_File = null;
var Evidence_file_name = null;
if (document.getElementById("file").files.length != 0) {
SA_Supp_Evidence_Object_File = document.getElementById('file').files[0];
var fr = new FileReader;
fr.onloadend = function () {
alert(fr.result);
};
fr.readAsBinaryString(SA_Supp_Evidence_Object_File);
Evidence_file_name = SA_Supp_Evidence_Object_File.name;
};
Step 2: Now i want to retrieve the same data from database and able to download by clicking the link
<td><a href="_self">Download</a></td>
Can any one help me to solve this problem
I tried like this
var data = 'data:text/plain;base64,'+L_EncodedData;
document.location = data;