Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In short:</p> <pre><code>&lt;input type="file" /&gt; </code></pre> <p>Cannot be submitted via ajax, it has to be a full postback. Traditionally you use an iFrame for this if you want AJAX style behavior. I've used a few solutions to this, without knowing what platform you're on, <a href="http://demo.swfupload.org/" rel="noreferrer">SWFUpload</a> is usually a good option.</p> <p>Here's a full document example of a fix:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;script type="text/javascript" src="Javascript/jquery-1.3.2.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="Javascript/jquery.form.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function() { $('#fileUploadForm').ajaxForm({ beforeSubmit: ShowRequest, success: SubmitSuccesful, error: AjaxError }); }); function ShowRequest(formData, jqForm, options) { var queryString = $.param(formData); alert('BeforeSend method: \n\nAbout to submit: \n\n' + queryString); return true; } function AjaxError() { alert("An AJAX error occured."); } function SubmitSuccesful(responseText, statusText) { alert("SuccesMethod:\n\n" + responseText); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="fileUploadForm" method="POST" action="Default.aspx" enctype="multipart/form-data"&gt; &lt;input type="text" name="filename" /&gt; &lt;input type="file" id="postedFile" name="postedFile" /&gt; &lt;input type="submit" value="Submit" /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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