من کد زیر را برای ذخیره و بازیابی عکس نوشتم ولی هنگام اجرا دستور request.Files.count همیشه صفره و عکسی رو ذخیره نمیکنه
به نظرتون باید چیکار کرد؟


این ویو است:
 
<div class="form-group">
@Html.LabelFor(m => m.Image,new { @class = "col-md-2 control-label" })
<div class="col-md-10">
<input type="file" name="Image" id="FileUpload" accept=".png,.jpg,.gif,.tif"/>
</div>
</div>




این متد userPhotos برای بازیابی عکس:

public FileContentResult UserPhotos()
{
if (User.Identity.IsAuthenticated)
{
string userId = User.Identity.GetUserId();

if (userId == null)
{
string fileName = HttpContext.Server.MapPath(@"/Images/noImg.gif");

byte[] imageData = null;
FileInfo fileInfo = new FileInfo(fileName);
long imageFileLength = fileInfo.Length;
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
imageData = br.ReadBytes((int)imageFileLength);

return File(imageData, "image/gif");

}
// to get the user details to load user Image
var bdUsers = HttpContext.GetOwinContext().Get<ApplicationDbCont ext>();
var userImage = bdUsers.Users.Where(x => x.Id == userId).FirstOrDefault();
byte[] imageData2 = null;

if (userImage.Image== null)
{
string fileName = HttpContext.Server.MapPath(@"/Images/noImg.gif");

FileInfo fileInfo = new FileInfo(fileName);
long imageFileLength = fileInfo.Length;
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
imageData2 = br.ReadBytes((int)imageFileLength);
}
return new FileContentResult(imageData2, "image/gif");


}
else
{
string fileName = HttpContext.Server.MapPath(@"/Images/noImg.gif");

byte[] imageData = null;
FileInfo fileInfo = new FileInfo(fileName);
long imageFileLength = fileInfo.Length;
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
imageData = br.ReadBytes((int)imageFileLength);
return File(imageData, "image/gif");

}
}




این هم کد ثبت عکس

public async Task<ActionResult> Register([Bind(Exclude = "Image")] RegisterViewModel model)
{
if (ModelState.IsValid)
{
byte[] imageData = null;

if (Request.Files.Count > 0)
{
HttpPostedFileBase PoImageFile = Request.Files["Image"];
using(var binary=new BinaryReader(PoImageFile.InputStream))
{
imageData = binary.ReadBytes(PoImageFile.ContentLength);
}
}
var user = new ApplicationUser { UserName = model.Email, Email = model.Email , FirstName=model.FirstName,LastName=model.LastName };

user.Image = imageData;