views:

69

answers:

1

I have a web page which have 3 controls:

  1. form using the post command.
  2. in the form i have an input file control named "myFile".
  3. a button

the upload process works just fine, until I'm trying to post the form and handle the upload in another form.

Request["myFile"] and request.Params["myFile"] gave me nothing

A: 

It's the Request.Files collection you need - look it up in the .NET Framework docs:

Request.Files["myFile"]

Also make sure that the enctype attribute of your upload form is set correctly - it should be "multipart/form-data" if the form contains file inputs.

Mark B
this is not good enough, it gives me a string which represents the address of the file, but i need a HtmlInputFile structure
No, you don't - read the docs. Request.Files["myFile"] returns an HttpPostedFile object which has all the properties you'll need, and even a SaveAs method to save the file out to disk.
Mark B