Subject: file upload processed on separate page
Posted By: vauneen Post Date: 8/8/2006 3:03:02 AM
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);
 }
}

Go to topic 31465

Return to index page 209
Return to index page 208
Return to index page 207
Return to index page 206
Return to index page 205
Return to index page 204
Return to index page 203
Return to index page 202
Return to index page 201
Return to index page 200