Upload files to the server via HTTP POST.

xiaoxiao2021-03-06  135

When writing ASP.NET applications, it often encounters the case of the client uploaded file. At this time, customers generally want to want Windows applications, you can choose the folder, browse the files you want to download, upload, this time. Features:

1. Customers can browse local folders, select multiple files simultaneously .2. Before uploading, users cannot predict the number of uploaded files. 3. Because it is an ASP.NET application, the client may not be installed .NET Framework.

In fact, we know. If you want to interact with the IE-end customer file system, the code must be executed on the client. At this time we can write an ActiveX control to implement the selection folder and upload.

Generally, we often use two ways to upload files

1. FTP, you can call some ready-made FTP components, which can call Internet Transfer Control in VB.

2. HTTP, use the HTTP Post Application / OCTET-Stream format to the server.

FTP is easy to achieve, we do not consider, and it will highlight the way HTTP.

When we upload a single file, we generally have the following code:

<% @ Page language = "c #" autoeventwireup = "true"%>