HttpPostedFile.FileName - Different from IE

后端 未结 4 1368
南旧
南旧 2020-12-09 02:44

When I upload a file to a site using the ASP:File control the FileName property is different in IE and Firefox. In Firefox, it just provides the name of the file, but IE pr

4条回答
  •  星月不相逢
    2020-12-09 03:17

    You also can use Path.GetFileName(File.FileName) that return only file name. Example:

    Dim File As HttpPostedFile = context.Request.Files("txtFile")
    ' let's FileName is "d:\temp\1.txt"
    Dim FileName As String = Path.GetFileName(File.FileName)
    ' FileName will be "1.txt"
    

提交回复
热议问题