views:

111

answers:

2

First I must say that my problem happens when I'm trying to post to another form.

I have 3 controls in a form: 1. text input named "text1". 2. file input named "file1". 3. submit input.

the form itself have a post method to another page. in the page load of the posted page I'm using Request["text1"] which gives me the text of "text1". when I'm Request["file1"] I get nothing.

help?

+2  A: 

You need enctype="multipart/form-data" in your opening form tag.

<form method="post" action="somepage.php" enctype="multipart/form-data">
...
</form>

If that doesn't help, 4GuysFromRolla have an article on this very topic:

Uploading in ASP.NET

Jonathan Sampson
i have it and it doesn't help
+1  A: 

Request["file1"] is not a string, it's a file, so you can't peek inside it that way. How it is handled will depend on the server-size platform you're using.

Diodeus
in the code behind of the same page - you're correct, but this is the way i get it from another asp.net page.