Answers:
在您的aspx中:
<form id="form1" runat="server" enctype="multipart/form-data">
 <input type="file" id="myFile" name="myFile" />
 <asp:Button runat="server" ID="btnUpload" OnClick="btnUploadClick" Text="Upload" />
</form>
在后面的代码中:
protected void btnUploadClick(object sender, EventArgs e)
{
    HttpPostedFile file = Request.Files["myFile"];
    //check file was submitted
    if (file != null && file.ContentLength > 0)
    {
        string fname = Path.GetFileName(file.FileName);
        file.SaveAs(Server.MapPath(Path.Combine("~/App_Data/", fname)));
    }
}
              var fileUploaded = document.getElementById("myFile").files[0];甚至可以使用readAsArrayBuffer以下命令获取字节:stackoverflow.com/questions/37134433/…-但是您打算如何处理所有这些字节的客户端?OP希望完全避免ASP.NET控件而不是服务器端的通信。-1给你。
                    这是一个不依赖任何服务器端控制的解决方案,就像OP在问题中描述的那样。
客户端HTML代码:
<form action="upload.aspx" method="post" enctype="multipart/form-data">
    <input type="file" name="UploadedFile" />
</form>
upload.aspx的Page_Load方法:
if(Request.Files["UploadedFile"] != null)
{
    HttpPostedFile MyFile = Request.Files["UploadedFile"];
    //Setting location to upload files
    string TargetLocation = Server.MapPath("~/Files/");
    try
    {
        if (MyFile.ContentLength > 0)
        {
            //Determining file name. You can format it as you wish.
            string FileName = MyFile.FileName;
            //Determining file size.
            int FileSize = MyFile.ContentLength;
            //Creating a byte array corresponding to file size.
            byte[] FileByteArray = new byte[FileSize];
            //Posted file is being pushed into byte array.
            MyFile.InputStream.Read(FileByteArray, 0, FileSize);
            //Uploading properly formatted file to server.
            MyFile.SaveAs(TargetLocation + FileName);
        }
    }
    catch(Exception BlueScreen)
    {
        //Handle errors
    }
}
              Request.Files[0]代替,Request.Files["UploadedFile"]而OP使用的是纯ASP.NET而不是MVC,如果有人想将其用于MVC,则只需要HttpPostedFileBase使用HttpPostedFile。
                    将HTML控件与runat服务器属性一起使用
 <input id="FileInput" runat="server" type="file" />
然后在asp.net中
 FileInput.PostedFile.SaveAs("DestinationPath");
如果您感兴趣,还有一些第三方选项将显示进度
<asp:FileUpload ID="fileUpload1" runat="server"></asp:FileUpload>),这与说不要runat=server在input字段上放置不同。
                    HtmlInputFile控件。
                    是的,您可以通过ajax post方法来实现。在服务器端,您可以使用httphandler。因此,我们没有根据您的要求使用任何服务器控件。
使用ajax,您还可以显示上传进度。
您将不得不将文件作为输入流读取。
using (FileStream fs = File.Create("D:\\_Workarea\\" + fileName))
    {
        Byte[] buffer = new Byte[32 * 1024];
        int read = context.Request.GetBufferlessInputStream().Read(buffer, 0, buffer.Length);
        while (read > 0)
        {
            fs.Write(buffer, 0, read);
            read = context.Request.GetBufferlessInputStream().Read(buffer, 0, buffer.Length);
        }
    } 
样例代码
function sendFile(file) {              
        debugger;
        $.ajax({
            url: 'handler/FileUploader.ashx?FileName=' + file.name, //server script to process data
            type: 'POST',
            xhr: function () {
                myXhr = $.ajaxSettings.xhr();
                if (myXhr.upload) {
                    myXhr.upload.addEventListener('progress', progressHandlingFunction, false);
                }
                return myXhr;
            },
            success: function (result) {                    
                //On success if you want to perform some tasks.
            },
            data: file,
            cache: false,
            contentType: false,
            processData: false
        });
        function progressHandlingFunction(e) {
            if (e.lengthComputable) {
                var s = parseInt((e.loaded / e.total) * 100);
                $("#progress" + currFile).text(s + "%");
                $("#progbarWidth" + currFile).width(s + "%");
                if (s == 100) {
                    triggerNextFileUpload();
                }
            }
        }
    }
              fs.close()其他所有内容,这些内容可能最终会以无法读取的文件形式出现,因为它们在IIS中始终保持打开状态。
                    正如其他人所回答的那样,Request.Files是一个HttpFileCollection,其中包含所有发布的文件,您只需要向该对象索要以下文件:
Request.Files["myFile"]
但是,当有多个具有相同属性名称的输入标记时会发生什么:
Select file 1 <input type="file" name="myFiles" />
Select file 2 <input type="file" name="myFiles" />
在服务器端,先前的代码Request.Files [“ myFile”]仅返回一个HttpPostedFile对象,而不是两个文件。我在.net 4.5上看到了一个名为GetMultiple的扩展方法,但是对于过时的版本,它不存在,为此,我提出了以下扩展方法:
public static IEnumerable<HttpPostedFile> GetMultiple(this HttpFileCollection pCollection, string pName)
{
        for (int i = 0; i < pCollection.Count; i++)
        {
            if (pCollection.GetKey(i).Equals(pName))
            {
                yield return pCollection.Get(i);
            }
        }
}
此扩展方法将返回HttpFileCollection中名称为“ myFiles”的所有HttpPostedFile对象(如果存在)。
我一直都在用这个。
runat="server",这实际上会将其转变为他们不希望使用的服务器控件。
                    这是一个代码项目文章,其中包含可下载的项目,旨在解决此问题。免责声明:我尚未测试此代码。 http://www.codeproject.com/KB/aspnet/fileupload.aspx
//create a folder in server (~/Uploads)
 //to upload
 File.Copy(@"D:\CORREO.txt", Server.MapPath("~/Uploads/CORREO.txt"));
 //to download
             Response.ContentType = ContentType;
             Response.AppendHeader("Content-Disposition", "attachment;filename=" + Path.GetFileName("~/Uploads/CORREO.txt"));
             Response.WriteFile("~/Uploads/CORREO.txt");
             Response.End();
              
runat="server"它,它并不独立于ASP.NET的服务器内容