input file

a260881071 2009-04-13 08:52:29
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页 </title>
<script type="text/javascript">
function showvalue()
{
alert(document.getElementById("File1").value);
}
</script>
</head>
<body>
<form id="form1" runat="server" enctype="multipart/form-data">
<input id="File1" type="file" />
</form>
<input id="Button1" type="button" onclick="showvalue()" value="button" />
</body>
</html>

上传任何位置的任何文件 点Button1 都弹出C:\fakepath\文件名 (ie6 为文件的完整路径)

我用的是ie8(好像ie不一样这里的value都不一样)不知道我说的对不对


我非常急已经有两个星期了,之前也有提问可是没人回答我,

如果上述问题不能解决的话 我只要一个控件,它有属性能获得客户端的文件的完整地址即可

fjqagx@yahoo.com.cn


...全文
283 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjs77233357 2009-06-02
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 thinkbad 的回复:]
ie8 安全设置里有一项:将本地文件上载至服务器时包含本地目录路径 这个在默认安全级别里是被禁用的
所以你获取不到,你估计是开发了个跟文件上传相关的控件吧?想获取文件本地路径?

引用微软给的说明:
input type=file object, the value of the value property depends on the value of the "Include local directory path when uploading files to a server" security setting for the security zone used to displ…
[/Quote]
这样可以获取,谢谢
zjs77233357 2009-06-02
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 zhoufoxcn 的回复:]
在IE7之后这个功能好像就不行了,作为你来说可能方便了,但是作为IE来说安全性降低了,还有很多类似的效果从IE7之后都有些问题了。
[/Quote]
谢谢
thinkbad 2009-04-27
  • 打赏
  • 举报
回复
ie8 安全设置里有一项:将本地文件上载至服务器时包含本地目录路径 这个在默认安全级别里是被禁用的
所以你获取不到,你估计是开发了个跟文件上传相关的控件吧?想获取文件本地路径?

引用微软给的说明:
input type=file object, the value of the value property depends on the value of the "Include local directory path when uploading files to a server" security setting for the security zone used to display the Web page containing the input object.

The fully qualified filename of the selected file is returned only when this setting is enabled. When the setting is disabled, Internet Explorer 8 replaces the local drive and directory path with the string C:\fakepath\ in order to prevent inappropriate information disclosure.
a260881071 2009-04-14
  • 打赏
  • 举报
回复
我不上传文件,我就要得到客户端的路径,请问有什么方法吗?
周公 2009-04-14
  • 打赏
  • 举报
回复
在IE7之后这个功能好像就不行了,作为你来说可能方便了,但是作为IE来说安全性降低了,还有很多类似的效果从IE7之后都有些问题了。
coodd 2009-04-13
  • 打赏
  • 举报
回复
你上传文件,没必要用到客户端路径

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧