halvorn

halvorn

  • NA
  • 33
  • 0

Posting file from one aspx to another

Dec 9 2006 5:11 AM
Hello, I tried posting this in the asp.net section, but this section maybe better.

I am trying to post a file from one aspx to an aspx. I am able to get data values, like textboxes and filename of the file I`m uploading, but I don`t understand how to catch the datafile in the C#-fila.

The aspx that posts the file would look something like this:

form id="form1" runat="server"
input type="file" id="image" name="picture"
asp:textbox runat="server" id="Data"
asp:button runat="server" id="buttonPost" Text="Click" PostBackUrl="upload.aspx"
form


The file that recieves data could maybe look something like this, but how do I code the c# to catch the file that is posted?

protected void Page_Load(object sender, EventArgs e)
{
//this would fetch the filename I`m uploading
string testing1= Server.HtmlEncode(Request.Form["picture"]);
//This would get data entered in the textbox
string testing = Request.Form["Data"];
}


As said, I am able to recieve text variables, but my problem is how to recieve the posted file.
Any clue anybody?