name
name

Reputation:

posting file input type to a form

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?

Upvotes: 0

Views: 506

Answers (2)

Sampson
Sampson

Reputation: 268344

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

Upvotes: 2

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114347

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.

Upvotes: 1

Related Questions