var inputElement = document.getElementById("File1");
inputElement.addEventListener("change", handleFiles, false);
function handleFiles() {
var fileList = this.files;
for (var i = 0 ; i < fileList.length ; i++) {
var file_name = fileList[i].name;
var ext = file_name.substring(file_name.lastIndexOf("."), file_name.length).toUpperCase();
if (ext != ".BMP" && ext != ".PNG" && ext != ".GIF" && ext != ".JPG" && ext != ".JPEG") {
$("#file_list .clear").before('<div class="file_model "><span οnclick="delete_file(0)">x</span><img src="/images/files.png") /><p>' + fileList[i].name + '</p></div>');
}
else {
var reader = new FileReader();
reader.onload = function (evt) {
$("#file_list .clear").before('<div class="file_model "><span οnclick="delete_file(0)">x</span><img src="' + evt.target.result + '") /><p>' + file_name + '</p></div>');
}
reader.readAsDataURL(fileList[i]);
}
}
}
inputElement.addEventListener("change", handleFiles, false);
function handleFiles() {
var fileList = this.files;
for (var i = 0 ; i < fileList.length ; i++) {
var file_name = fileList[i].name;
var ext = file_name.substring(file_name.lastIndexOf("."), file_name.length).toUpperCase();
if (ext != ".BMP" && ext != ".PNG" && ext != ".GIF" && ext != ".JPG" && ext != ".JPEG") {
$("#file_list .clear").before('<div class="file_model "><span οnclick="delete_file(0)">x</span><img src="/images/files.png") /><p>' + fileList[i].name + '</p></div>');
}
else {
var reader = new FileReader();
reader.onload = function (evt) {
$("#file_list .clear").before('<div class="file_model "><span οnclick="delete_file(0)">x</span><img src="' + evt.target.result + '") /><p>' + file_name + '</p></div>');
}
reader.readAsDataURL(fileList[i]);
}
}
}