Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Document</title>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
- </head>
- <body>
- <div id="upload-image-preview">
- >>>>>> PICTURE WILL REPLACE THIS CONTENT <<<<<<
- </div>
- <hr/>
- <input id="pic-inp" type="file" name="pic" accept="image/*">
- <script>
- $("#pic-inp").change(function () {
- if (this.files && this.files[0]) {
- var reader = new FileReader();
- reader.onload = function (e) {
- var img = $('<img>').attr('src', e.target.result);
- $('#upload-image-preview').html(img);
- };
- reader.readAsDataURL(this.files[0]);
- }
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement