Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

show selected image input file from database

<html lang="en">
<head>
    <title>Change image on select new image from file input</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
</head>
<body>


<input type="file" name="file" id="profile-img">
<img src="" id="profile-img-tag" width="200px" />


<script type="text/javascript">
    function readURL(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();
            
            reader.onload = function (e) {
                $('#profile-img-tag').attr('src', e.target.result);
            }
            reader.readAsDataURL(input.files[0]);
        }
    }
    $("#profile-img").change(function(){
        readURL(this);
    });
</script>


</body>
</html>
Comment

PREVIOUS NEXT
Code Example
Javascript :: get the authors username discord.js 
Javascript :: TypeError: fxn.call is not a function 
Javascript :: onpress not working when textinput isfocused in react native 
Javascript :: node 14: fsevents@1.2.13: fsevents 1 will break on node 
Javascript :: javascript remove last element 
Javascript :: js map delete item 
Javascript :: es6 closures 
Javascript :: mariadb javascript 
Javascript :: how to get gmt time in javascript 
Javascript :: changing photo with js 
Javascript :: jquery get id of 3rd parent 
Javascript :: lodash get first element of array 
Javascript :: intersection of two objects in javascript 
Javascript :: discord.js v13 joinVoiceChannel 
Javascript :: remove cookie 
Javascript :: how to connect socket in react js 
Javascript :: change view port of svg with javascript 
Javascript :: como colocar dados no firebase 
Javascript :: remove green lines on google maps js 
Javascript :: reverse method in javascript 
Javascript :: nodejs curd insert update delete 
Javascript :: jqerrt get all img alt from string 
Javascript :: ipcrenderer preload.js 
Javascript :: javascript match against array 
Javascript :: picture in picture remove from videojs 
Javascript :: regular expression to validate m/d/yyyy HH:MM:SS AM 
Javascript :: javascript target closest id 
Javascript :: how to clear all slash commands 
Javascript :: react i18n with parameeter 
Javascript :: babel compile files empty 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =