Filename:

Upload image in firefox and chrome

<html>

<body>

   <form name="Upload" enctype="multipart/form-data" method="post">

         Filename: <INPUT type="file" id="submit">

         <INPUT type="button" id="send" value="Upload">

    </form>

    <div id="div" align="center" style="height: 200px;width: 500px;border-style: ridge;border-color: red"></div>

</body>

<script type="text/javascript">



var img_id=0

var image = new Array()

document.getElementById('send').onclick=function()

{

    img_id++

    var id="imgid"+img_id

    image = document.getElementById('submit').value;

    document.getElementById('div').innerHTML="<img id='"+id+"' src='"+image+"' width=500px height=200px>"



}



</script>



</html>

The problem with this code is that it only works in IE, not in another browser (firefox, chrome, ... etc.). Thanks in advance.

Edit: (updated my post in response to Naren, Bitslitter's) Guys, here is the text that needs to be added to the discussion below:

Thank you guys for the feedback, the feedback from Naren and Bitzlittert was definitely helpful.

Could you please advise how to do what I want to do here:

- , , , -. , , canvas HTML5 SVG ( JS). , .

-, Mugtug Darkroom (http://mugtug.com/darkroom/), , .

+3
2

Google Chrome, Ctrl + Shift + J, " " "". - FireFox Firebug. IE , . Chrome FireFox .

+5

IE ( "c:\documents\image_path\image.ext" ) input.value, .

IE , . ( , ), .

, .

+4

Source: https://habr.com/ru/post/1772590/


All Articles