title: asp.net mvc jquery form upload
body: <p>I am using jQuery form up to upload the file but am unable to return any message from the controller. Am I doing it right below?</p>
  
  <pre><code>$(function() {
      $('#fileUploadForm').ajaxForm({               
          type: "POST",
          dataType: "json",             
          beforeSubmit: ShowRequest,
          success: SubmitSuccesful,
          error: AjaxError                               
      });                                    
  });   
  
  function ShowRequest(formData, jqForm, options) {
      var queryString = $.param(formData);
      return true;
  }
  
  function AjaxError() {
      $("#msgs").html("A file upload error occured.");
  }
  
  function SubmitSuccesful(responseText, statusText) {
      $("#fileUploadForm").unblock();
      $.growlUI(null, responseText.message);
  }    
  </code></pre>
  
  <pre class="lang-cs prettyprint-override"><code>public FileUploadJsonResult AjaxPostTypeUpload(HttpPostedFileBase postedFile)
  {
      try
      {
          string mess = string.Empty;          
          mess = "success";              
          return new FileUploadJsonResult { Data = new { message = mess }};
      }
      catch { throw; }
  }
  </code></pre>