2
Answers

how we make extensection of images to uplode in mvc

habib ullah

habib ullah

7y
168
1
if (file != null && file.ContentLength > 0)
{
var allowedExtensions = new[] { ".png", ".jpeg", ".jpg" };
file.SaveAs(Server.MapPath("~/images/") + file.FileName);
emp.imag = file.FileName;
}
is not working and not show the extension in the images 
Answers (2)
0
habib ullah

habib ullah

NA 116 2k 7y
sir please define the details of the above code
0
Manas Mohapatra

Manas Mohapatra

NA 29.3k 3.3m 7y
You can use Path.GetExtension()
 
string myFilePath = @"C:\Manas.txt";
string ext = Path.GetExtension(myFilePath); //.txt