I have an HTML page with a form:
<form method="post" enctype="multipart/form-data" action="saveform.aspx">
And the form has lots of inputs that are passed along to saveform.aspx with no problem, but I’m not sure how to grab and save the posted file:
<input name="Certificate" id="Certificate" type="file">
I’m trying this but getting 0 for the count:
HttpFileCollection MyFileCollection = Request.Files;
Response.Write("MyFileCollection.Count: " + MyFileCollection.Count); // Returns 0
for (int i = 0; i < MyFileCollection.Count; i++) {
MyFileCollection[i].SaveAs("Testing.txt");
}
Any ideas? I can grab all other form elements just fine using Request.Form[“–whatever key–”] just fine but having a tough time with files.
Thanks!