file upload processed on separate page
hi, I need to upload a file using asp.net c#, but i need the form to be processed on separate page. my code (below) cant seem to see the MyFile object on the processing page, can anyone please help? Vauneen
form page:
code in code section:
void cmdPost_Click(Object src, EventArgs e ) {
Server.Transfer("promoadd_action.aspx", true);
}
code within the form:
<input type="file" id="MyFile" runat="server" name="MyFile" class='txtinput'>
processing page:
void Page_Load(Object src, EventArgs e ) {
if( MyFile.PostedFile != null ){
string strFileName = MyFile.PostedFile.FileName;
strFileName = System.IO.Path.GetFileName(strFileName);
MyFile.PostedFile.SaveAs(Server.MapPath("./promoimages/") + strFileName);
}
}
|