projects
/
cascardo
/
ipsilon.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Verify that uploaded files are readable when selected
[cascardo/ipsilon.git]
/
templates
/
admin
/
option_config.html
diff --git
a/templates/admin/option_config.html
b/templates/admin/option_config.html
index
02babe6
..
14326fd
100644
(file)
--- a/
templates/admin/option_config.html
+++ b/
templates/admin/option_config.html
@@
-38,7
+38,13
@@
var reader = new FileReader(); // instance of the FileReader
reader.readAsDataURL(files[0]); // read the local file
var reader = new FileReader(); // instance of the FileReader
reader.readAsDataURL(files[0]); // read the local file
- reader.onloadend = function(){ // set image data as background of div
+ reader.onloadend = function(e){ // set image data as background of div
+ var contents = e.target.result;
+ if (!contents) {
+ window.alert('Image file is unreadable')
+ document.getElementById('uploadFile').value = null;
+ }
+
$("#imagePreview").css("background-image", "url("+this.result+")");
}
}
$("#imagePreview").css("background-image", "url("+this.result+")");
}
}