View Single Post
  #1 (permalink)  
Old August 8th, 2006, 03:03 AM
vauneen vauneen is offline
Registered User
Join Date: Jun 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default file upload processed on separate page

hi, I need to upload a file using 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);