title: Limiting image upload to jpg in ASP .NET MVC
body: <p>I'm still new to Asp .Net MVC, and C#. I'm experiencing with learning how to do certain things and I'm running into a problem with getting the button to load my view. I learned that I don't need an event listener like I normally would in .NET MVC, so I used @Ajax.ActionLink for my button. However, when I click on my button it doesn't load my view. I can't figure out why? I can't make the button load my view. </p>
  
  <p>Here's what I have done. In my shared folder, I have a layout page that will include a button. I inserted this button: </p>
  
  <pre><code>&lt;li&gt;@Ajax.ActionLink("Res-TestImageExtension","TestImageExtension","TestImageExtension","",App.ViewOptions.appAjaxOptions,App.ViewOptions.blueButtonHtmlAttributes)&lt;/li&gt;
  </code></pre>
  
  <p>In my controller folder I have inserted a controller with the following: </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.IO;
  using System.Linq;
  using System.Web;
  using System.Web.Mvc;
  
  namespace HexaPod.Controllers
  {
  
  public class TestImageExtensionController : Controller
  {
  // For multiple file select
      [HttpPost]
      public ActionResult Create(List&lt;HttpPostedFileBase&gt; image)
      {
  
          if (image != null)
          {
              foreach (var item in image)
              {
                  string filePath = Path.Combine(Server.MapPath("~/App_Data"),   Path.GetFileName(item.FileName));
                  item.SaveAs(filePath);
              }
          }
  
          return PartialView("TestImageExtension");
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Model: </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.Mvc;
  
  namespace HexaPod.Models
  {
  public partial class ImageUpload {
    public int ID { get; set;} 
  
    public string ImagePath {get; set;} 
  }
  }
  </code></pre>
  
  <p>View: </p>
  
  <pre><code>@model HexaPod.Models.ImageUpload
  
  @{
  ViewBag.Title = "Image Upload";
  }
  
  @*
  
  *@
  @using (Html.BeginForm("Create", "Profile", FormMethod.Post, new { enctype =  
  "multipart/form-data", id = "frm_profile" }))
  {
  @Html.LabelFor(model =&gt; model.ImagePath)
  @Html.TextBoxFor(model =&gt; model.ImagePath, new { type = "file", accept = "image/jpeg,  image/jpg"}) @Html.ValidationMessageFor(model =&gt; model.ImagePath)
  // for multiple file select
  @Html.TextBoxFor(model =&gt; model.ImagePath, new { type = "file", accept = "image/jpeg,   image/jpg", multiple = "multiple" })
  }
  </code></pre>