日期:2014-05-17  浏览次数:20469 次

asp.net上传文件出错:System.IO.FileNotFoundException:未能找到文件c:\windows\system32\inetsrv
win 7,iis7.5,asp.net,vs2010 上传图片出错。

在 ie8.0.7600.16385 下上传正常。在360浏览器下正常。
在ie7, ie8.0.2000,chrome,firefox,safari,傲游下 都不正常

跟踪进去 InputFile.PostedFile.FileName 取到的只是 beauty.jpg,没能取客户端的全路径
我设置iis的虚拟目录权限为来宾用户允许写入 也不行。
我设置enctype属性也没解决:  <form id="form1" runat="server" enctype="multipart/form-data"> 

我的问题:怎么取到 文件的全路径?


报错信息:

System.IO.FileNotFoundException: 未能找到文件“c:\windows\system32\inetsrv\beauty.jpg”。文件名:“c:\windows\system32\inetsrv\beauty.jpg” 在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 在 System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) 在 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) 在 System.IO.FileInfo.OpenRead() 在 AppManager.Web.Admin.Company.frmCompanyEdit.SetUploadPic() 位置 F:\vss_project\AppManager\4.编码阶段\v1.0\Web\Admin\Company\frmCompanyEdit.aspx.cs:行号 259 

------解决方案--------------------
最好贴全代码 
------解决方案--------------------
JavaScript获取FileUpload上传文件的全路径 


       //函数功能,获取FileUpload上传文件的全路径
        function getFullPath(obj)
        {
            if(obj)
            {
                //ie
                if (window.navigator.userAgent.indexOf("MSIE")>=1)
                {