p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Professional (http://p2p.wrox.com/forumdisplay.php?f=215)
-   -   file upload processed on separate page (http://p2p.wrox.com/showthread.php?t=46271)

vauneen August 8th, 2006 03:03 AM

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);
 }
}


All times are GMT -4. The time now is 07:17 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.