Hi,
I have used file upload control in HTML web-resource.
Please find the code below.
We have developed an add-on by which you can upload image files into forms in CRM.
This add-on uses the HTML 5 file upload control.
<input id="iptFile" onchange="addPicture(this.files)" type="file" accept="image/gif,image/jpeg,image/png"
style="visibility: hidden" />
function addPicture(files) {
var reader;
try {
reader = new FileReader();
} catch (err) {
alert(HTML5AlertMsg);
return;
}
reader.onload = function (e) {
// e.target.result holds the DataURL which
// can be used as a source of the image:
if (e.target.result.length > max_file_size) {
alert(FileSizeBigMsg);
return;
}
};
// Reading the file as a DataURL. When finished,
// this will trigger the onload function above:
reader.readAsDataURL(files[0]);
}
Let me know if this solves your problem.