I have a form
<form action="/" method="post">
<input type="file" name="myFile" />
<input type="submit" name="submit" value="submit" />
</form>
I also have some C# code
if (Request["submit"] == "submit") {
Response.Write(Request.Files.Count);
}
If a user chooses a file on their system and submits, What reasons could there be for me seeing a "0" instead of a "1" in the Requ开发者_JAVA技巧est.Files.Count
property?
Try adding the enctype
attribute to your <form>
<form enctype="multipart/form-data" action="/" method="post">
If you are using any kind of ajax (i.e. update panel) then you have to make sure you're doing a full page post back when submitting not a partial page postback.
精彩评论