halvorn

halvorn

  • NA
  • 33
  • 0

Posting file/image to another page

Dec 8 2006 5:53 PM
Hello,

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.

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 to get 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"];
}


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