Created
October 22, 2019 11:04
-
-
Save nyl2k8/0508fe3fd7f9cc8dc00a5d6bacbce4d5 to your computer and use it in GitHub Desktop.
Revisions
-
nyl2k8 created this gist
Oct 22, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ <form action="/controller.php" method="post" enctype="multipart/form-data"> <input type="file" id="imgInput" name="file" /> <img src="/assets/default_empty.png" id="upImage" src="#" alt="Upload Image" /> </form> <script type="text/javascript"> function readURL(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function(e) { $('#upImage').attr('src', e.target.result); } reader.readAsDataURL(input.files[0]); } } $("#imgInput").change(function() { readURL(this); }); </script>