title: FineUploader failing to POST
body: <p>I'm trying to implement file uploading using FineUploader. Everything is working except the actual upload - when I select a file, it is instantly added to the page saying "Upload failed". Looking at the Network tab in Firefox's inspector, no POST request is even happening, and I'm getting an error message from FineUploader saying the response is not valid JSON (go figure). </p>
  
  <p>Here's my client-side (partial) view:</p>
  
  <pre><code>&lt;div id="fine-uploader"&gt;&lt;/div&gt;
  
  @* This section is rendered into the page header *@
  @section Scripts {
      &lt;script src="/Scripts/fine-uploader/jquery.fine-uploader.js"&gt;&lt;/script&gt;
      &lt;link href="/Scripts/fine-uploader/fine-uploader-new.css" rel="stylesheet" /&gt;
  
      @* The following template is copied from the Validation example at https://fineuploader.com/demos.html in the jQuery tab *@
      &lt;script type="text/template" id="qq-template"&gt;
          &lt;div class="qq-uploader-selector qq-uploader" qq-drop-area-text="Drop files here"&gt;
              &lt;div class="qq-total-progress-bar-container-selector qq-total-progress-bar-container"&gt;
                  &lt;div role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" class="qq-total-progress-bar-selector qq-progress-bar qq-total-progress-bar"&gt;&lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="qq-upload-drop-area-selector qq-upload-drop-area" qq-hide-dropzone&gt;
                  &lt;span class="qq-upload-drop-area-text-selector"&gt;&lt;/span&gt;
              &lt;/div&gt;
              &lt;div class="qq-upload-button-selector qq-upload-button"&gt;
                  &lt;div&gt;Select files&lt;/div&gt;
              &lt;/div&gt;
              &lt;span class="qq-drop-processing-selector qq-drop-processing"&gt;
                  &lt;span&gt;Processing dropped files...&lt;/span&gt;
                  &lt;span class="qq-drop-processing-spinner-selector qq-drop-processing-spinner"&gt;&lt;/span&gt;
              &lt;/span&gt;
              &lt;ul class="qq-upload-list-selector qq-upload-list" aria-live="polite" aria-relevant="additions removals"&gt;
                  &lt;li&gt;
                      &lt;div class="qq-progress-bar-container-selector"&gt;
                          &lt;div role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" class="qq-progress-bar-selector qq-progress-bar"&gt;&lt;/div&gt;
                      &lt;/div&gt;
                      &lt;span class="qq-upload-spinner-selector qq-upload-spinner"&gt;&lt;/span&gt;
                      &lt;img class="qq-thumbnail-selector" qq-max-size="100" qq-server-scale&gt;
                      &lt;span class="qq-upload-file-selector qq-upload-file"&gt;&lt;/span&gt;
                      &lt;span class="qq-upload-size-selector qq-upload-size"&gt;&lt;/span&gt;
                      &lt;button type="button" class="qq-btn qq-upload-cancel-selector qq-upload-cancel"&gt;Cancel&lt;/button&gt;
                      &lt;button type="button" class="qq-btn qq-upload-retry-selector qq-upload-retry"&gt;Retry&lt;/button&gt;
                      &lt;button type="button" class="qq-btn qq-upload-delete-selector qq-upload-delete"&gt;Delete&lt;/button&gt;
                      &lt;span role="status" class="qq-upload-status-text-selector qq-upload-status-text"&gt;&lt;/span&gt;
                  &lt;/li&gt;
              &lt;/ul&gt;
  
              &lt;dialog class="qq-alert-dialog-selector"&gt;
                  &lt;div class="qq-dialog-message-selector"&gt;&lt;/div&gt;
                  &lt;div class="qq-dialog-buttons"&gt;
                      &lt;button type="button" class="qq-cancel-button-selector"&gt;Close&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/dialog&gt;
  
              &lt;dialog class="qq-confirm-dialog-selector"&gt;
                  &lt;div class="qq-dialog-message-selector"&gt;&lt;/div&gt;
                  &lt;div class="qq-dialog-buttons"&gt;
                      &lt;button type="button" class="qq-cancel-button-selector"&gt;No&lt;/button&gt;
                      &lt;button type="button" class="qq-ok-button-selector"&gt;Yes&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/dialog&gt;
  
              &lt;dialog class="qq-prompt-dialog-selector"&gt;
                  &lt;div class="qq-dialog-message-selector"&gt;&lt;/div&gt;
                  &lt;input type="text"&gt;
                  &lt;div class="qq-dialog-buttons"&gt;
                      &lt;button type="button" class="qq-cancel-button-selector"&gt;Cancel&lt;/button&gt;
                      &lt;button type="button" class="qq-ok-button-selector"&gt;Ok&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/dialog&gt;
          &lt;/div&gt;
      &lt;/script&gt;    
  }
  
  &lt;script&gt;
      $("#fine-uploader").fineUploader({
          template: "qq-template",
          request: {
              // Generates the following absolute URL (have also tried relative, neither work)
              // http://localhost:49450/MyController/UploadFile
              endpoint: "@Url.Action("UploadFile", "My", null, Request.Url.Scheme)"
          },
          debug: true,
          thumbnails: {
              placeholders: {
                  waitingPath: "@Url.Content("~/Scripts/fine-uploader/placeholders/waiting-generic.png")",
                  notAvailablePath: "@Url.Content("~/Scripts/fine-uploader/placeholders/not_available-generic.png")"
              }
          },
          validation: {
              allowedExtensions: ["jpg", "png"],
              sizeLimit: 1048576 // 1 MB = 1024 * 1024 bytes
          },
          text: {
              fileInputTitle: ""
          }
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>And my MVC 4 controller code (<code>FineUpload</code> is a class from the nuget package of the same name):</p>
  
  <pre><code>public class MyController : Controller {
      // This method is never being hit
      [HttpPost]
      public FineUploaderResult UploadFile(FineUpload qqfilename) {
          return new FineUploaderResult(true);
      }
  }
  </code></pre>
  
  <p>And here's Firefox's console log after attempting an upload (I've omitted all the success messages preceding this regarding thumbnail loading etc.):</p>
  
  <pre><code>[Fine Uploader 5.16.2] Sending simple upload request for 0
  util.js:236:16
  [Fine Uploader 5.16.2] xhr - server response received for 0
  util.js:236:16
  [Fine Uploader 5.16.2] responseText =
  util.js:236:16
  [Fine Uploader 5.16.2] Received response status 0 with body:
  util.js:236:16
  [Fine Uploader 5.16.2] Error when attempting to parse xhr response text (JSON.parse: unexpected end of data at line 1 column 1 of the JSON data)
  util.js:241:20
  [Fine Uploader 5.16.2] Simple upload request failed for 0
  util.js:236:16
  </code></pre>
  
  <p>The code looks fine to me but the network activity log shows no POST requests are being made at all. Why would that be?</p>