Created
March 18, 2015 20:54
-
-
Save nickbewley/0d293ac43360e0914c1a to your computer and use it in GitHub Desktop.
Axure File Upload and Save — Check for File Inputted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Getting the file name and contents from the input field | |
function readURL(input) { | |
if (input.files && input.files[0]) { | |
var reader = new FileReader(); | |
reader.onload = function (e) { | |
$('[data-label="UploadPreview"]').children('img').attr('src', e.target.result); | |
} | |
reader.readAsDataURL(input.files[0]); | |
} | |
} | |
// When the file input field changes do above function | |
$('#UploadInput').change(function(){ | |
readURL(this); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment