System.Web Namespace HttpRequest Class
Gets the collection of client-uploaded files ( Multipart MIME format ).
[ VB ]
Public ReadOnly Property Files As HttpFileCollection
[ C# ]
public HttpFileCollection Files {get;}
[ C++ ]
public: __property HttpFileCollection* get_Files ( );
[ JScript ]
public function get Files ( ) : HttpFileCollection;
An HttpFileCollection object representing a collection of client-uploaded files.
The file collection is populated only when the HTTP request Content-Type is multipart/form-data
.
The following example writes out the names of all files in the Files collection.
// load file collection into a string array
string [ ] myFiles = Request.Files.AllKeys;
// loop thru the array
for ( int i = 0; i < myFiles.Length; i++ ) {
Response.Write ( "File: " + myFiles [ i ] + "<br>" );
}
' load file collection into a string array
Dim myFiles ( ) As String = Request.Files.AllKeys
' loop thru the array
Dim i As Integer
for i = 0 To myFiles.GetUpperBound ( 0 )
Response.Write ( "File: " & myFiles ( i ) & "<br>" )
Next i |
|
C# |
VB |
HttpRequest Members HttpFileCollection Class