Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery File upload error when submitting to ashx
    primarykey
    data
    text
    <p>I am attempting to use the <a href="http://aquantum-demo.appspot.com/file-upload" rel="nofollow">Jquery file upload</a> addon to asynchronously upload files to a C3 http handler. I have gone through the setup steps on the <a href="https://github.com/blueimp/jQuery-File-Upload/wiki/Setup" rel="nofollow">GitHub site</a> for the project. It seems to work fine in Firefox but throws a javascript error in IE ('Exception thrown and not caught'. Line 95, Char 25, File: test.html), even though the file is successfully uploaded. I think my issue is related to the response of my ashx. Can anyone see what I am doing wrong?</p> <p>Here is the body of the html for my page (test.html):</p> <pre><code>&lt;form id="file_upload" action="testupload.ashx" method="POST" enctype="multipart/form-data"&gt; &lt;input type="file" name="file" multiple&gt; &lt;button&gt;Upload&lt;/button&gt; &lt;div&gt;Upload files&lt;/div&gt; &lt;/form&gt; &lt;table id="files"&gt;&lt;/table&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"&gt;&lt;/script&gt; &lt;script src="../Script/jquery.fileupload.js"&gt;&lt;/script&gt; &lt;script src="../Script/jquery.fileupload-ui.js"&gt;&lt;/script&gt; &lt;script&gt; /*global $ */ $(function () { $('#file_upload').fileUploadUI({ uploadTable: $('#files'), downloadTable: $('#files'), buildUploadRow: function (files, index) { return $('&lt;tr&gt;&lt;td&gt;' + files[index].name + '&lt;\/td&gt;' + '&lt;td class="file_upload_progress"&gt;&lt;div&gt;&lt;\/div&gt;&lt;\/td&gt;' + '&lt;td class="file_upload_cancel"&gt;' + '&lt;button class="ui-state-default ui-corner-all" title="Cancel"&gt;' + '&lt;span class="ui-icon ui-icon-cancel"&gt;Cancel&lt;\/span&gt;' + '&lt;\/button&gt;&lt;\/td&gt;&lt;\/tr&gt;'); }, buildDownloadRow: function (file) { return $('&lt;tr&gt;&lt;td&gt;' + file.name + '&lt;\/td&gt;&lt;\/tr&gt;'); } }); }); &lt;/script&gt; </code></pre> <p>Here is the code in my ashx:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.IO; namespace Testing { /// &lt;summary&gt; /// Summary description for $codebehindclassname$ /// &lt;/summary&gt; public class TestUpload : IHttpHandler { public void ProcessRequest(HttpContext context) { HttpPostedFile fileupload = context.Request.Files[0]; string strFileName = Path.GetFileName(fileupload.FileName); string strExtension = Path.GetExtension(fileupload.FileName).ToLower(); string strSaveLocation = context.Server.MapPath("Upload") + "\\" + strFileName; fileupload.SaveAs(strSaveLocation); context.Response.ContentType = "text/plain"; context.Response.Write("{\"name\":\"" + fileupload.FileName + "\",\"type\":\"" + fileupload.ContentType + "\",\"size\":\"" + fileupload.ContentLength + "\"}"); } public bool IsReusable { get { return true; } } } } </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.
 

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