Skip to content Skip to sidebar Skip to footer

How To Get The Image File Name In An Http Post Request

I'm pretty new to MVC and I'm trying to get just the file name of the newly selected file. The html code looks like this:

Solution 1:

you can try this just to extract the file name

var fileName = Path.GetFileName(file.FileName);

or in other case you can do

var name = file.FileName.Split(',')[1].ToString();

Post a Comment for "How To Get The Image File Name In An Http Post Request"