Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("input:file").change(function(e){
- var input=e.target;
- // create a new FileReader object, and …
- var reader=new FileReader();
- // … tell it what to do in case of it successfully loading the file
- reader.onloadend=function(e){
- var fileBase64=e.target.result;
- $(input).siblings("input:text").first().val(fileBase64);
- };
- // … and have it load the file
- reader.readAsDataURL(input.files[0]);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement