title: How can i get filename from input type "file" in ASP.NET MVC Project?
body: <p>I'm new to ASP.NET and i'd be so grateful if someone could help.
  I have my file input:</p>
  
  <pre><code>&lt;form action="NewProject.cshtml" method="post" enctype="multipart/form-data"&gt;
  &lt;fieldset&gt;
    &lt;legend&gt; Upload Image &lt;/legend&gt;
    &lt;label for="Image"&gt;Image&lt;/label&gt;
    &lt;input type="file" name="Image" id ="filename"/&gt;
    &lt;br/&gt;
    &lt;input type="submit" value="Upload" id="Add" /&gt;
  &lt;/fieldset&gt;
  </code></pre>
  
  <p></p>
  
  <p>To upload image i use:</p>
  
  <pre><code>@{  WebImage photo = null;
  var newFileName = "";
  var imagePath = "";
  
  if(IsPost){
      photo = WebImage.GetImageFromRequest();
      if(photo != null){
          newFileName = Guid.NewGuid().ToString() + "_" +
              Path.GetFileName(photo.FileName);
          imagePath = @"Images\" + newFileName;
  
          photo.Save(@"~\" + imagePath);
  //an attempt
         PoleInvestProject.Models.Project project = new PoleInvestProject.Models.Project();
              project.Image = imagePath; //storing in model property Image
  
          }
      }
  }
  </code></pre>
  
  <p>And now i need to get the path of the image from there and associate it with my model, which has the property <code>public string Image { get; set; }</code>. I want to store this file path in my database by <code>DBContext context</code>. </p>
  
  <pre><code>  context.Projects.Add(new Project()
              {
  
                  Image = model.Image
  
              });
              context.SaveChanges();
  </code></pre>
  
  <p>But this gives me NULL, there's nothing in my database table for <code>Projects</code>.
  What am I doing wrong?
  Thanks in advance!</p>