HttpPostedFile.FileName - 从不同的IE浏览器 [英] HttpPostedFile.FileName - Different from IE

查看:1211
本文介绍了HttpPostedFile.FileName - 从不同的IE浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我上传一个文件使用ASP网站:文件控制FileName属性是在IE和Firefox不同。在Firefox中,它只是提供了文件的名称,但IE提供了完整的文件路径。

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 provides the full path to the file.

我已经加入code解决此工作:

I have worked around this by adding the code:

Dim FileName As String = file.FileName
If FileName.LastIndexOf("\") > 0 Then
    FileName = FileName.Substring(FileName.LastIndexOf("\") + 1)
End If

但我不知道为什么,这将是不同的浏览器之间是不同的。有谁知道这样做的原因?

But I'm not sure why that would be different between the different browsers. Does anyone know the reason for this?

感谢。

推荐答案

这是一个安全/隐私问题,火狐/ Mozilla是这样做的权利,你不会得到一种方式来获得完整的路径没有加载项,小程序,Silverlight的,闪光或一些其他机制。

This is a security/privacy concern, firefox/mozilla is doing it right and you will not get a way to get the full path without an add-in, applet, silverlight, flash or some other mechanism.

下面是Mozilla的立场更多的信息:

Here is more info on Mozilla's stance:

<一个href=\"https://developer.mozilla.org/en/Updating_web_applications_for_Firefox_3\">https://developer.mozilla.org/en/Updating_web_applications_for_Firefox_3

请参阅上一节安全Changes->文件上传域

我希望IE就会跟风,所以我们有一个一致的和安全的环境。

I hope IE will follow suit so we have a consistent and secure environment.

这篇关于HttpPostedFile.FileName - 从不同的IE浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆