title: how to upload image path into database in asp mvc?
body: <p>I new to MVC. I want to upload image path into the database. I refferd many tutorial. Most Of the tutorial says like</p>
  
  <pre><code>     [HttpPost]
          public ActionResult Index(FormCollection form, HttpPostedFileBase file)
          {
              var allowedExtensions = new[] {  
              ".Jpg", ".png", ".jpg", "jpeg"  
          };
              tblDemo tbl = new tblDemo();
              tbl.Photo = file.ToString(); //getting complete url  
              tbl.Name = form["Name"];
              var fileName = Path.GetFileName(file.FileName);
              var ext = Path.GetExtension(file.FileName);
              /..Remining code here../
  }
  </code></pre>
  
  <p>but i am getting the error like Object reference not set to an instance of an object in file object (getting as file=NULL),I followed same like in many tutorial,all i am getting is same error. Then what is wrong with me?
  Give me please some solution for uploading image path into database and image to the folder (i don't want to save image to the database)  </p>