看到了思归的asp.net 大文件上传问题的一篇文章http://blog.joycode.com/saucer/archive/2004/03/16/16225.aspxIServiceProvider provider = (IServiceProvider) HttpContext.Current;
HttpWorkerRequest wr = (HttpWorkerRequest) provider.GetService(typeof(HttpWorkerRequest));
byte[] bs = wr.GetPreloadedEntityBody();
....
if (!wr.IsEntireEntityBodyIsPreloaded())
{
int n = 1024;
byte[] bs2 = new byte[n];
while (wr.ReadEntityBody(bs2,n) >0)
{
.....
}
}照着做了一下,遇到了一个问题,我的上传页面如下:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server" enctype= "multipart/form-data">
<div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:FileUpload ID="FileUpload2" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
</body>
</html>
上传文件后保存的文件内容如下:
-----------------------------7d8fb30b62
Content-Disposition: form-data; name="__VIEWSTATE"/wEPDwUKMTI0MTQ5MTgxMGRkJlBBW+RnyE08+fccGv56o7XnMeI=
-----------------------------7d8fb30b62
Content-Disposition: form-data; name="FileUpload1"; filename="C:\New Text Document.txt"
Content-Type: text/plain上传文件的内容
-----------------------------7d8fb30b62
Content-Disposition: form-data; name="FileUpload2"; filename=""
Content-Type: application/octet-stream
-----------------------------7d8fb30b62
Content-Disposition: form-data; name="Button1"Button
-----------------------------7d8fb30b62
Content-Disposition: form-data; name="__EVENTVALIDATION"/wEWAgK9zN1nAoznisYG7rNMhJseSPFrmQaIMT1PmnhtDR4=
-----------------------------7d8fb30b62--可以看到保存的文件中并包括了“起始,结束标志”“文件说明”及页面上其他控件("Button")
那么应该如何过滤掉其他无用的信息呢???请赐教!!!!!
HttpWorkerRequest wr = (HttpWorkerRequest) provider.GetService(typeof(HttpWorkerRequest));
byte[] bs = wr.GetPreloadedEntityBody();
....
if (!wr.IsEntireEntityBodyIsPreloaded())
{
int n = 1024;
byte[] bs2 = new byte[n];
while (wr.ReadEntityBody(bs2,n) >0)
{
.....
}
}照着做了一下,遇到了一个问题,我的上传页面如下:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server" enctype= "multipart/form-data">
<div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:FileUpload ID="FileUpload2" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
</body>
</html>
上传文件后保存的文件内容如下:
-----------------------------7d8fb30b62
Content-Disposition: form-data; name="__VIEWSTATE"/wEPDwUKMTI0MTQ5MTgxMGRkJlBBW+RnyE08+fccGv56o7XnMeI=
-----------------------------7d8fb30b62
Content-Disposition: form-data; name="FileUpload1"; filename="C:\New Text Document.txt"
Content-Type: text/plain上传文件的内容
-----------------------------7d8fb30b62
Content-Disposition: form-data; name="FileUpload2"; filename=""
Content-Type: application/octet-stream
-----------------------------7d8fb30b62
Content-Disposition: form-data; name="Button1"Button
-----------------------------7d8fb30b62
Content-Disposition: form-data; name="__EVENTVALIDATION"/wEWAgK9zN1nAoznisYG7rNMhJseSPFrmQaIMT1PmnhtDR4=
-----------------------------7d8fb30b62--可以看到保存的文件中并包括了“起始,结束标志”“文件说明”及页面上其他控件("Button")
那么应该如何过滤掉其他无用的信息呢???请赐教!!!!!
解决方案 »
- 用System.net.mail.MailMessage 向OUTLOOK发送会议邀请,循环会议的邀请和取消
- DataSet的数据筛选问题
- 在c# winform里面输入字体的问题
- listview里面想每项嵌套个picturebox,还可以啊?
- 请问我在一个方法中this.timer1.Enabled = true;但是timer没有运行?
- 如何读文件
- C#连接sqlServer2005数据库问题
- Web页面中的用户控件中的按扭如何对Web页面进行操作?
- 急求一个正则表达式
- 新手提问:C# .NET和C++ .NET的区别【谢谢大家帮忙!】
- ===求教如何实现通过程序读取sql数据库的信息,然后插入acess表中===
- C# 宏替换
我是想用上面提到的方法读取上传内容