title: ASP.NET MVC file upload working on local build, NOT working after deployment
body: <p>This code for uploading image file is working fine when built on localhost. But upon deployment, it is not working and not giving any error. </p>
  
  <p>I tried changing the imagePath from <code>/Content/Images/Items/</code> to <code>~/Content/Images/Items/</code> and <code>Content/Images/Items/</code>. Still no solution.</p>
  
  <pre><code>[HttpPost]
  public ActionResult AddProduct(ProductDisplay productDisplay,HttpPostedFileBase upload)
  {
      bool isSaved = false;
      string fileName = string.Empty;
      string imagePath = string.Empty;
      try
      {
          if(upload!=null &amp;&amp; upload.ContentLength&gt;0)
          {
              fileName = System.IO.Path.GetFileName(upload.FileName);
              imagePath = "/Content/Images/Items/" + fileName;
              upload.SaveAs(Server.MapPath(imagePath));
          }
          else
              imagePath = "/Content/Images/Items/" + "NoImage.jpg";
          productDisplay.ImagePath = imagePath;
          ProductMangementBL balProduct = new ProductMangementBL();
          isSaved = balProduct.AddProduct(productDisplay);
      }
      catch (Exception ex)
      {
          isSaved = false;
      }
      return RedirectToAction("ProductList", new RouteValueDictionary(new { controller = "Product", action = "ProductList", Id = productDisplay.CategoryID }));
  }
  </code></pre>