title: Asynchronous processing asp.net mvc with client side progress feedback
body: <p>I am building an image management tool and I want to know how I can create a Vimeo-like experience. </p>
  
  <p><strong>Description of what needs to happen</strong><br>
  The user will be able to upload many potentially large images using <a href="http://www.plupload.com/" rel="noreferrer">plupload</a> (no page reload). Then the server will take the following actions on each uploaded image.</p>
  
  <ul>
  <li>The image will be resized into
  several versions (e.g. thumb, small,
  medium, large) </li>
  <li>Each copy will have
  some image processing done (e.g.
  convolution filter)</li>
  <li>These resized
  copies will be uploaded to Amazon S3</li>
  <li>Info about each image will be stored
  to a database (width, height,
  mimetype, filename)</li>
  <li>Then the server should trigger some sort of feedback to the user</li>
  </ul>
  
  <p><strong>Providing Asyncronous Feedback</strong><br>
  Plupload (image uploading tool) has really nice visual feedback when uploading the files to my server, however, I want to be able to give additional feedback to the user while the server is doing all the image processing and uploading to remote storage.</p>
  
  <p>Vimeo does this nicely. When you upload a video it gives confirmation that it has been uploaded, but then says "we are encoding your video, please wait" and the UI gives some sort of progress indicator.</p>
  
  <p>I would like to give the user two kinds of feedback after the images have been uploaded to my server. Each time an image has been processed and uploaded to S3 I would like to:</p>
  
  <ul>
  <li>Update a message on the browser
  saying "5 of 15 images have been
  processed" and I would like to  </li>
  <li>Have a thumbnail of that image appear.</li>
  </ul>
  
  <p><strong>An Example MVC Controller Action</strong></p>
  
  <pre><code>[HttpPost]
  public virtual ContentResult Upload(Guid albumId)
  {
    foreach (string file in Request.Files)
    {
      HttpPostedFileBase f = Request.Files[file] as HttpPostedFileBase;
      if (f.ContentLength == 0)
        continue;
  
      var uploadDir = Server.MapPath("~/uploads/"+ albumId);
      var filePath = Path.Combine(uploadDir, Path.GetFileName(hpf.FileName));
      f.SaveAs(filePath);
  
      // How can I trigger some async task here that would be able
      // to trigger some sort of feedback to the browser when complete?
      SomeAsyncImageProcessor.ProcessImage(albumId, filePath); // ???
    }
  
    return Content("Success", "text/plain");
  }
  </code></pre>
  
  <p><strong>Constraints</strong><br>
  The people using this web app will be using the latest version of Chrome. No cross-browser issues need to be addressed. We are using asp.net MVC 3 and SQL Server 2005</p>
  
  <p>Can anyone point me in the right direction? 
  Are there any great resources out there to show how I can accomplish something like this?</p>