asp.net 文件上传报错
来源:互联网 发布:java中的^ 编辑:程序博客网 时间:2024/04/30 23:51
问题:IE8、部分IE7可正常上传,但部分IE7和IE六上传失败。虚拟路径无效。
解决方案:
private void UpLoad()
{
string filePath = "";
//**********************************************************问题1**********************************************************
//filePath = this.FileUpload1.PostedFile.FileName;//之前的写法,IE6、7报错
HttpPostedFile PostFile = this.FileUpload1.PostedFile;//上传的文件对象(正常)
filePath = System.IO.Path.GetFileName(PostFile.FileName); //文件名(正常)
DirectoryInfo upDir = new DirectoryInfo(Server.MapPath("../SystemManage/DocumentManage"));
if (!upDir.Exists)
{
upDir.Create();
}
int m = filePath.LastIndexOf("."); //取得文件名中最后一个"."的索引
string newext = filePath.Substring(m);
int ContentLength = this.FileUpload1.PostedFile.ContentLength;
int UploadedLength = 0;
if (FileUpload1.FileContent.Length != 0)
{
DateTime now = DateTime.Now; //获取系统时间
string path1 = (filePath.Split('.')[0] + DateTime.Now.ToString("yyyMMddHHmmss").Trim() + newext).Trim();
string path = this.Server.MapPath(@"DocumentManage/" + Server.HtmlEncode(path1));
try
{
FileUpload1.PostedFile.SaveAs(path); //上传大文件发布以后报错
}
catch (Exception ex)
{ }
}
}
- asp.net 文件上传报错
- Asp.Net上传文件报错“超过了最大请求长度”
- asp.net文件上传
- ASP.Net文件上传
- ASP.Net文件上传
- ASP.NET上传文件
- asp.net文件上传
- ASP.NET上传文件
- Asp.Net 文件上传
- asp.net上传文件
- ASP.NET上传文件
- asp.net上传文件
- asp.net文件上传
- ASP.NET上传文件
- ASP.NET文件上传
- ASP.NET上传文件
- asp.net上传文件
- 文件上传(asp.net)
- VS2008+WDK开发环境搭建
- java 集合类学习总结
- struts2+hibernate 兴趣爱好的迭代
- ORACLE 报表数据库开发设想
- Linux中find常见用法示例
- asp.net 文件上传报错
- VM 快捷键
- Android使用dom4j时报 java.lang.NoClassDefFoundError错误的处理办法
- 解决MySQL不能远程登录_用户创建与授权_grant all privileges on(转)
- bash if 错误
- Eclipse Plug in 开发 学习点滴(3) - EFS(Eclipse File System 简称EFS) 获得指定目录下的 文件/文件夹 列表
- Codeforces Round #124 (Div. 2) / C. Lexicographically Maximum Subsequence
- Linux下的Shell编程基础知识
- dwr(Direct Web Remoting)的使用