Reputation: 251
How to open the file using FileDialog and display the path into textbox in asp.net mvc?
Upvotes: 0
Views: 3341
Reputation: 2547
use <input type="file" name="imageFile" />
on the controller for your POST method include this HttpPostedFileBase imageFile
if (imageFile != null && imageFile.ContentLength > 0)
{
var fileName = Path.GetFileName(imageFile.FileName);
var fileExtension = Path.GetExtension(imageFile.FileName);
}
Upvotes: 1