Added file extension verification

This commit is contained in:
Ravi Riley 2020-04-28 04:24:10 -07:00
parent 46508072ec
commit f37c921031

13
main.js
View File

@ -202,12 +202,9 @@ function handleFileSelect(evt) {
progress.style.width = '0%';
progress.textContent = '0%';
var extension = String(evt).match(/\.[0-9a-z]+$/i);
console.log(extension);
console.log(evt);
console.log(evt.target.baseURI);
//if
var filename = evt.target.files[0].name;
var extension = String(filename.match(/\.[0-9a-z]+$/i));
if (extension == ".stl") {
reader = new FileReader();
reader.onerror = errorHandler;
reader.onprogress = updateProgress;
@ -228,7 +225,9 @@ function handleFileSelect(evt) {
// Read in the stl file as a binary string.
reader.readAsBinaryString(evt.target.files[0]);
//}endif?
}
else
error();
}
function abortRead() {