laravel load image to div on image selected via input file

Solutions on MaxInterview for laravel load image to div on image selected via input file by the best coders in the world

showing results for - "laravel load image to div on image selected via input file"
Gianluca
01 Mar 2016
1<html lang="en">
2<head>
3    <title>Change image on select new image from file input</title>
4    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
5</head>
6<body>
7
8
9<input type="file" name="file" id="profile-img">
10<img src="" id="profile-img-tag" width="200px" />
11
12
13<script type="text/javascript">
14    function readURL(input) {
15        if (input.files && input.files[0]) {
16            var reader = new FileReader();
17            
18            reader.onload = function (e) {
19                $('#profile-img-tag').attr('src', e.target.result);
20            }
21            reader.readAsDataURL(input.files[0]);
22        }
23    }
24    $("#profile-img").change(function(){
25        readURL(this);
26    });
27</script>
28
29
30</body>