文件上传元素出现问题 [英] Problem with file upload element

查看:80
本文介绍了文件上传元素出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我目前在文件上传元素上遇到问题.我正在使用Visual Studio 2010 Express.
如果我尝试上传一个大文件(〜4 MB),则什么也没有发生.而是显示无法显示此页面",就像出现连接问题一样.
对于较小的文件,它确实可以正常工作.
调试时,我发现甚至没有调用上载按钮事件处理程序的第一行.

有人可以帮我吗?

谢谢

解决方案



maxRequestLenght是您要上传的文件的最大大小.

这应该为您解决问题.但是,如果您通过将大文件分成小块并在服务器上加入小块来上传大文件,这是一个好习惯.


要更改此大小限制,您可以在web.config .comments(可在C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG)的ASP.NET 2.0配置文件夹中找到)或应用程序的web.config文件中进行一些更改.

在web.config.comments文件中,找到一个名为< httpRuntime>的节点.如下所示:
复制

< httpRuntime
 executionTimeout = " 
 maxRequestLength = " 
 requestLengthDiskThreshold = " 
 useFullyQualifiedRedirectUrl = " 
 minFreeThreads = " 
 minLocalRequestFreeThreads = " 
 appRequestQueueLimit = " 
 enableKernelOutputCache = " 
 enableVersionHeader = " 
 requireRootedSaveAsPath = " 
 enable = " 
 shutdownTimeout = " 
 delayNotificationTimeout = " 
 waitChangeNotification = " 
 maxWaitChangeNotification = " 
 enableHeaderChecking = " 
 sendCacheControlHeader = " 
 apartmentThreading = " /> 


Hallo,

I am currently having a problem with a file upload element. I am using Visual Studio 2010 Express.
If I try to upload a large file (~ 4 MB), nothing happens. Instead "this page cannot be displayed" is shown, as if there were connection issues.
It does work fine for smaller files.
When debugging, I found out that not even the first line of the upload button event handler is called.

Can someone help me?

Thanks

Upload large file in asp.net mvc[^]


That''s because By default asp.net allows u to upload a file of maximum size 4096kb.

u need to do changes in your web.config

add

<httpruntime></httpruntime>



node in web.config

and set maxRequestLength to whatever the max size of the file you need to upload in bytes.

<httpruntime maxrequestlenght="8192" executiontimeout="400" />



maxRequestLenght is the max size of the file u want to upload.

this should do the trick for you However it''s a good practice if u upload your large file by dividing it into pieces and joining the pieces at server.


To change this size limit, you make some changes in either the web.config.comments (found in the ASP.NET 2.0 configuration folder at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG) or your application''s web.config file.

In the web.config.comments file, find a node called <httpRuntime> that looks like the following:
Copy

<httpRuntime
 executionTimeout="110"
 maxRequestLength="4096"
 requestLengthDiskThreshold="80"
 useFullyQualifiedRedirectUrl="false"
 minFreeThreads="8"
 minLocalRequestFreeThreads="4"
 appRequestQueueLimit="5000"
 enableKernelOutputCache="true"
 enableVersionHeader="true"
 requireRootedSaveAsPath="true"
 enable="true"
 shutdownTimeout="90"
 delayNotificationTimeout="5"
 waitChangeNotification="0"
 maxWaitChangeNotification="0"
 enableHeaderChecking="true"
 sendCacheControlHeader="true"
 apartmentThreading="false" />


这篇关于文件上传元素出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆