Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
HTML5 <input type=“file” accept=“image/*” capture=“camera”> display as image rather than “choose file” button
Use the JavaScript FileReader to allow users to choose an image.
Let us see an example −
Here is the JS −
function readURL(input) {
if (input.files && input.files[0]) {
var r = new FileReader();
r.onload = function (ev) {
$('#myid).attr('src', ev.target.result);
}
reader.readAsDataURL(input.files[0]);
}
} Advertisements
