FileUpload.FileBytes 获取 OutOfMemoryException
FileUpload.FileBytes get OutOfMemoryException
我使用 FileUpload 组件。我添加了大约 120mb 的文件。但是当文件大小增加时,FileBytes 得到错误 OutOfMemoryException
FileBytes returns byte[].
我的代码:
byte[] byt = new byte[0];
byt = FileUpload1.FileBytes;
我需要获取文件并转换字节数组或者我可以使用js。
我必须得到文件。但我采用文件路径。 Return 值为 c:/fakepath.... 是错误的。
有什么解决办法吗?
在你的 web.config 中,你有两个参数来处理这个问题:
<system.web>
<httpRuntime maxRequestLength="X" executionTimeout="Y"/>
</system.web>
(X 以千字节为单位,Y 以秒为单位)
和
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="Z" />
</requestFiltering>
</security>
</system.webServer>
(Z 以字节为单位)
我使用 FileUpload 组件。我添加了大约 120mb 的文件。但是当文件大小增加时,FileBytes 得到错误 OutOfMemoryException
FileBytes returns byte[].
我的代码:
byte[] byt = new byte[0];
byt = FileUpload1.FileBytes;
我需要获取文件并转换字节数组或者我可以使用js。 我必须得到文件。但我采用文件路径。 Return 值为 c:/fakepath.... 是错误的。
有什么解决办法吗?
在你的 web.config 中,你有两个参数来处理这个问题:
<system.web>
<httpRuntime maxRequestLength="X" executionTimeout="Y"/>
</system.web>
(X 以千字节为单位,Y 以秒为单位)
和
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="Z" />
</requestFiltering>
</security>
</system.webServer>
(Z 以字节为单位)