Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Are you sure that the click is working ? Because I think you are not writing the java script code correctly.</p> <p>You need to get the <code>ClientID</code> of the file upload in java script</p> <p>like this:</p> <pre><code>document.getElementById('&lt;%= FileUploaddd2.ClientID %&gt;').click(); </code></pre> <p>After your Update, I was able to run the code successfully...</p> <p>I think you need to add this line after the try catch block inside the if block in your server side code...</p> <pre><code> Try sb.AppendFormat(" Uploading file: {0}", FileUpload1.FileName) 'saving the file FileUpload1.SaveAs("c:\SaveDirectory\" + FileUpload1.FileName) 'Showing the file information sb.AppendFormat("&lt;br/&gt; Save As: {0}", FileUpload1.PostedFile.FileName) sb.AppendFormat("&lt;br/&gt; File type: {0}", FileUpload1.PostedFile.ContentType) sb.AppendFormat("&lt;br/&gt; File length: {0}", FileUpload1.PostedFile.ContentLength) sb.AppendFormat("&lt;br/&gt; File name: {0}", FileUpload1.PostedFile.FileName) Catch ex As Exception sb.Append("&lt;br/&gt; Error &lt;br/&gt;") sb.AppendFormat("Unable to save file &lt;br/&gt; {0}", ex.Message) End Try lblmessage.Text = sb.ToString() </code></pre> <p><strong>AFTER UPDATE</strong></p> <p>After seeing the update regarding the Internet Explorer. I think your problem is this:</p> <p><a href="https://stackoverflow.com/questions/210643/in-javascript-can-i-make-a-click-event-fire-programmatically-for-a-file-input">Simulating the click on input type="file" using javascript</a></p> <p>This might also help: <a href="https://stackoverflow.com/questions/143747/is-it-possible-to-trigger-a-links-or-any-elements-click-event-through-javasc#143771">Browser check before executing an event</a></p> <p>You can also use Ajax Control Toolkit's AjaxFileUpload for better display and features like drag and drop are already implemented in that: <a href="http://bit.ly/13Upt0z" rel="nofollow noreferrer">Have a look</a>. This way you won't have to simulate a click on the button.</p>
 

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