uploading image and Internet Explorer

bedfordczarina

New Member
How to solve that also in IE like?:\[code\]$(document).ready(function() { //i want to hide the <input type="file"...>\[/code\]and file explorer opening width am image clicking\[code\] $("#preview").html('<img src="http://stackoverflow.com/questions/15861056/uploads/default.png" class="preview" />').click(function() { $('#imgfile').click(); });\[/code\]there is ok in firefox, ghrome, safari and opera\[code\] $('#imgfile').bind('change', function() { $("#preview").html(''); $("#preview").html('<img src="http://stackoverflow.com/questions/15861056/loader.gif" alt="Uploading...."/>');\[/code\]...but in internet explorer the ajaxForm-function doesnt work and stay to show a loading image:\[code\] $("#imageform").ajaxForm({ target: '#preview' }).submit(); }); $("#imgfile").hide();});\[/code\]And html-code is there:\[code\]<div style="width:600px"> <form id="imageform" method="post" enctype="multipart/form-data" action='ajaximage.php'> <input type="file" name="imgfile" id="imgfile" /> </form> <div id='preview'></div></div>\[/code\]and css-code:\[code\].preview { width:100px; height:100px; border:solid 1px #dedede; padding:0px; margin:0px; color:#cc0000; font-size:12px}\[/code\]..and ajaimage.php looks like:\[code\]<?php$path = "uploads/";$valid_formats = array("jpg", "png", "gif", "bmp");if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['imgfile']['name']; $size = $_FILES['imgfile']['size']; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { if($size<(1024*1024)) { $actual_image_name = time().substr(str_replace(" ", "_", $txt), 5).".".$ext; $tmp = $_FILES['imgfile']['tmp_name']; if(move_uploaded_file($tmp, $path.$actual_image_name)) echo '<img src="http://stackoverflow.com/questions/15861056/uploads/'.$actual_image_name.'" class="preview" />'; else echo "failed"; } else echo "Image file size max 1 MB"; } else echo "Invalid file format.."; } else echo "Please select image..!";}?>\[/code\]Thank you
 
Back
Top