asp.net mvc HttpPostedFileBase getting file extension

Solution 1:

Like this:

string extension = Path.GetExtension(upload.FileName);

This will include a leading ..

Note that the you should not assume that the extension is correct.