开发者

asp.net mvc HttpPostedFileBase getting file extension

开发者 https://www.devze.com 2023-01-01 04:18 出处:网络
public string ContructOrganizationNameLogo(HttpPostedFileBase upload, string OrganizationName, int OrganizationID,string LangName)
public string ContructOrganizationNameLogo(HttpPostedFileBase upload, string OrganizationName, int OrganizationID,string LangName)
    {
         var UploadedfileName = Path.Ge开发者_运维百科tFileName(upload.FileName);
        string type = upload.ContentType;
    }

I want to get the extension of the file to dynamically generate the name of the file.One way i will use to split the type. but can i use HttpPostedFileBase object to get the extension in the clean way?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消