i have an issue file instance always null , below is the code:
[HttpPost]
public ActionResult Create(ExamRegisterationModel model, HttpPostedFileBase file)
{
if (file != null && file.ContentLength > 0)
{
string path = AppDomain.CurrentDomain.BaseDirectory + "uploads/";
string filename = Path.GetFileName(Request.Files[0].FileName);
Request.Files[0].SaveAs(Path.Combine(path, filename));
}
}
Any Idea how to upload the file?
And my View :
<div class="input-group">
<label for="file">Upload Receipt:</label>
<input type="file" name="File" id="file" />
<input type="submit" name="Submit" id="Submit" value="upload" />
</div>