title: File Uploading with AJax and MVC
body: <p>I have found multiple examples of file uploading but most of them use forms or it is by itself and the only thing being passed is the file.</p>
  
  <p>I have a page already passes data via Ajax to a controller.  I would like to add a file upload option to that existing Ajax call.  The file will be stored in a sql database so I'm assuming that I will need to pass the data or convert it to a byte array.</p>
  
  <p>My ajax call looks like this:</p>
  
  <pre><code> $("#btnNewTicket").click(function () {                  //Grabbing the Click Event of btnNewTicket
          var newTickTitle = $("#txtNewTickTitle").val();
          var newTickDesc = $("#txtNewTickDesc").val();
          var newTickCat = $("#ddCatList").val();
  
          $.ajax({
              url: '@Url.Action("AddTicket","HelpDesk")',
              data: { 'TickTitle': newTickTitle, 'TickDesc': newTickDesc, 'TickCat': newTickCat },
              type: 'GET',
              success: function (data) {
                  $("#loadpartial").empty();
                  alert("Ticket Successfully Submitted");
                  window.location.reload();
              },
  
              error: function (xhr, ajaxOptions, thrownError) {
                  alert(thrownError);
                  alert(xhr.status);
              }
          });
  </code></pre>
  
  <p>Is there a fairly straight forward way to do this simply?  Like basically adding another variable to the Ajax call?  Uploading a file seems so simple.  Or I could just not realize how involved it really is. </p>