Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Phần Html
- <a href="http://lesson8.blogspot.com/">http://lesson8.blogspot.com/</a>
- <form id="form1" runat="server">
- <input type='file' id="inputFile" />
- <img id="image_upload_preview" src="http://placehold.it/100x100" alt="your image" />
- </form>
- Phần JS
- function readURL(input) {
- if (input.files && input.files[0]) {
- var reader = new FileReader();
- reader.onload = function (e) {
- $('#image_upload_preview').attr('src', e.target.result);
- }
- reader.readAsDataURL(input.files[0]);
- }
- }
- $("#inputFile").change(function () {
- readURL(this);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement