<!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8" /> <title>スマホで取った写真をプレビュー表示</title> <style></style> <script> document.addEventListener("DOMContentLoaded", () => { document.querySelector("#btnScan").addEventListener("click", function() { document.querySelector("#fulImage").click(); }); document.querySelector("#fulImage").addEventListener("change", function(e) { var reader = new FileReader(); reader.onload = function (e) { document.querySelector("#imgPhoto").src = e.target.result; }; reader.readAsDataURL(e.target.files[0]); }); }); </script> </head> <body> <div><img id="imgPhoto" width="300" height="300"><div> <div> <input type="file" id="fulImage" style="display:none"> <button id="btnScan">scan</button> </div> </body> </html>