Getting extension of the file in FileUpload Control

后端 未结 3 673
孤独总比滥情好
孤独总比滥情好 2020-12-15 01:38

At the moment i get file extension of the file like :

string fileExt = System.IO.Path.GetExtension(filUpload.FileName);

But if the user cha

3条回答
  •  难免孤独
    2020-12-15 02:14

    Whatever the user renames the file extension to, that is the real file extension.

    You should never depend on the file extension to tell you what's in the file, since it can be renamed.

    See "how can we check file types before uploading them in asp.net?"

提交回复
热议问题