0
<!DOCTYPE html>
<html>
    <head>
        <style>
            body {
                background-color: rgba(113, 182, 142, 0.61);
            }
        </style>
    </head>
    <body>
        <input type="file" accept="image/*" id="filePut"/>
        <button id="send">Start</button>
        <img src="" id="image"/>
        <script>
            // Variables.
            var put = document.getElementById("filePut");
            var start = document.getElementById("send");
            var img = document.getElementById("image");
            // The send function.
            function onSend(){
                img.src = put.value.replace("C:\\fakepath\\", "");
                img.src = put.value;
            }
            // Call the function.
            start.addEventListener("click", onSend, false);
        </script>
    </body>
</html>

Error: net::ERR_FILE_NOT_FOUND

I tried removing the fake path, but it wont work. Is there any reason?

If you send the fixed code, then thanks. :p

rblx08
  • 3
  • 1
  • EITHER do `img.src = put.value.replace("C:\\fakepath\\", "");` OR do `img.src = put.value;` - you cannot do both – mplungjan Aug 09 '20 at 19:13

0 Answers0