Jump to content

Cross browser compatibility issues with image preview script.


drayarms

Recommended Posts



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML1.0 Transitional//EN"



"http//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 


<html xmlns="http://www.w3.org/1999/xhtml"> 


<head> 

	<script type = "text/javascript" src="http://code.jquery.com/jquery-latest.js"> </script>


	<script type="text/javascript">

        		function readURL(input) {

            			if (input.files && input.files[0]) {

                			var reader = new FileReader();

                			reader.onload = function (e) {

                    				$('#blah').attr('src', e.target.result);

                			}

                			reader.readAsDataURL(input.files[0]);

            			}

        		}

    		</script>



</head>


<body>


	<form id="form1" runat="server" enctype="multipart/form-data">

        		<input type='file' onchange="readURL(this);" />

        		<img id="blah" src="#" width = "300px" max-height = "340px" alt="your image" />

    		</form>


</body>



</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.