Skip to content

Instantly share code, notes, and snippets.

View Iqwertz's full-sized avatar
💻
Working on little Projects

Iqwertz

💻
Working on little Projects
View GitHub Profile
@liabru
liabru / read-local-file.js
Created April 24, 2014 17:42
Trigger a file open dialog and read local file in JavaScript
/*
* Trigger a file open dialog and read local file, then read and log the file contents
*/
var element = document.createElement('div');
element.innerHTML = '<input type="file">';
var fileInput = element.firstChild;
fileInput.addEventListener('change', function() {
var file = fileInput.files[0];