我有一个aspx页面,iframe里面有一个iframe我有一个ascx页面
代码示例
<form action="uploader.ashx" id="frmUploadPhoto" runat="server" method="post" enctype="multipart/form-data">
<div style="height: 80px;"></div>
<div >
<asp:fileupload runat="server" cssclass="btnSml" id="uploadPhoto" width="155px" />
<asp:button runat="server" cssclass="btnSml" id="btnUploadPhoto" text="Upload" />
</div>
</form>
我的问题是,如何将数据传递给ashx控件,以便我可以保存文件?
public class UploadHandler : IHttpHandler
{
public class Upload : IHttpHandler {
public void ProcessRequest(HttpContext context) {
HttpPostedFile oFile = context.Request.Files["Filedata"];
string sDirectory = HttpContext.Current.Server.MapPath("uploads");
oFile.SaveAs(sDirectory + oFile.FileName);
}
public bool IsReusable {
get { return false; }
}
}
}
提前谢谢