iis服务器接收post上传文件代码求助
<html>
<head>
</head>
<body>
<script Language="C#" AutoEventWireup="true" encType="multipart/form-data" ruat="server">
protected void Page_Load(object sender, EventArgs e)
{
try
{
foreach (string f in Request.Files.AllKeys)
{
string pathT = HttpRuntime.AppDomainAppPath.ToString() + "/images/";
string pathD = DateTime.Now.ToString("yyyyMMdd") + "/" + DateTime.Now.ToString("HHmm") + "/";
string sPath = pathT + pathD;
if (!Directory.Exists(sPath))
{
Directory.CreateDirectory(sPath);
}
HttpPostedFile file = Request.Files[f];
Random seed = new Random();
int randomNum =seed.Next(10,99);
string fileName = DateTime.Now.ToString("HHmmss") + randomNum.ToString() + ".jpg";
file.SaveAs(sPath + fileName);
Response.Write("http://..../images/" + pathD + fileName);
}
}
catch (Exception ex)
{
Response.Write("error");
}
Response.End();
}
</script>
</body>
</html>
以前没用过asp.net开发,现在要求做一个客户端post上传文件到服务器的功能,参照网上用记事本写了上面的upload.aspx文件,大家看下有什么问题吗,客户端怎么不能post上传文件?