有人用过SWFUpload?点击浏览早传时,总弹异常出框“500”
本地测试的时候没错,一上传到服务器就出错了:处理代码如下:public void ProcessRequest(HttpContext context)
{
try
{
string picPath = context.Request["Path"].ToString();
HttpPostedFile upload = context.Request.Files["Filedata"];
if (!Directory.Exists(picPath))
Directory.CreateDirectory(picPath);
//获得文件扩展名
string tFileType = upload.FileName.Substring(upload.FileName.LastIndexOf(".") + 1);
//以当前时间修改图片的名字
string modifyFileName = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + "." + tFileType;
upload.SaveAs(context.Server.MapPath(picPath + modifyFileName));
context.Response.StatusCode = 200;
context.Response.Write(picPath + modifyFileName);
}
catch(Exception e)
{
context.Response.StatusCode = 500;
context.Response.Write(e.Message);
context.Response.End();
}
finally
{
context.Response.End();
}
} --------------------编程问答-------------------- 楼主对那个保存上传文件的文件夹是否有权限????在服务器上赋权限 --------------------编程问答-------------------- 我试了一下,把文件夹设为777了,还是不行啊,真烦啊 --------------------编程问答-------------------- 高手,救命啊。。 --------------------编程问答-------------------- 路径问题,上传时Path指向的路径是什么?为什么Directory.Exists判断的是虚拟路径,而保存的时候要用Server.MapPath获取物理路径? --------------------编程问答-------------------- 保存的时候一定要物理路径的啊,Directory.Exists只是判断而已,没相干的。。。。。烦啊,那位大哥快帮我解决啊,困扰了两天了,客户在催啊。。。 --------------------编程问答-------------------- 不懂,帮顶下 --------------------编程问答-------------------- 晕菜,没高手在啊。。。 --------------------编程问答-------------------- 沉得太快了,救命,我要重发贴啦 --------------------编程问答-------------------- 又沉了
补充:.NET技术 , ASP.NET