Note that there are some explanatory texts on larger screens.

plurals
  1. POuploading image and Internet Explorer
    primarykey
    data
    text
    <p>How to solve that also in IE like?:</p> <pre><code>$(document).ready(function() { //i want to hide the &lt;input type="file"...&gt; </code></pre> <p>and file explorer opening width am image clicking</p> <pre><code> $("#preview").html('&lt;img src="uploads/default.png" class="preview" /&gt;').click(function() { $('#imgfile').click(); }); </code></pre> <p>there is ok in firefox, ghrome, safari and opera</p> <pre><code> $('#imgfile').bind('change', function() { $("#preview").html(''); $("#preview").html('&lt;img src="loader.gif" alt="Uploading...."/&gt;'); </code></pre> <p>...but in internet explorer the ajaxForm-function doesnt work and stay to show a loading image:</p> <pre><code> $("#imageform").ajaxForm({ target: '#preview' }).submit(); }); $("#imgfile").hide(); }); </code></pre> <p>And html-code is there:</p> <pre><code>&lt;div style="width:600px"&gt; &lt;form id="imageform" method="post" enctype="multipart/form-data" action='ajaximage.php'&gt; &lt;input type="file" name="imgfile" id="imgfile" /&gt; &lt;/form&gt; &lt;div id='preview'&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>and css-code:</p> <pre><code>.preview { width:100px; height:100px; border:solid 1px #dedede; padding:0px; margin:0px; color:#cc0000; font-size:12px } </code></pre> <p>..and ajaimage.php looks like:</p> <pre><code>&lt;?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&lt;(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 '&lt;img src="uploads/'.$actual_image_name.'" class="preview" /&gt;'; else echo "failed"; } else echo "Image file size max 1 MB"; } else echo "Invalid file format.."; } else echo "Please select image..!"; } ?&gt; </code></pre> <p>Thank you</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload