Displaying 1 result from an estimated 1 matches for "fileelem".
Did you mean:
file_len
2012 Sep 25
1
Show thumbnail preview of image before upload
Is there any ruby way to show thumbnail preview of image before upload?
Using below javascript, I can achieve this
window.URL = window.URL || window.webkitURL;
var fileElem = document.getElementById("fileElem");
function handleFiles(files) {
var img = document.getElementById("image-preview");
if (!files.length) {
img.src = "/img/default-profile-image.png";
} else {
img.src = window.URL.createObjectURL(files[0])...