上传限制是10MB以及如何在.cs文件中表示? [英] Upload Limit is 10MB and How to represent in .cs File?

查看:256
本文介绍了上传限制是10MB以及如何在.cs文件中表示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果在10.1Mb不接受之后如何在.Cs中写入逻辑(上传限制为10MB)



任何人请帮助我。

How to write logic in .Cs( Upload limit is 10MB) after 10.1Mb is not accept

Any one please help me.

推荐答案

This setting goes in your web.config file. It affects the entire application.

<configuration>
  <system.web>
    <httpRuntime maxRequestLength="xxx" />
  </system.web>
</configuration>
"xxx" is in KB. The default is 4096 (= 4 MB).





如果需要更多详细信息,请告诉我



Let me know if more details required


如果您使用的是文件上传控件,则可以直接检查文件大小。

If you are using the file upload control, you can directly check the file size.
// Get the size in bytes of the file to upload.
int fileSize = FileUpload1.PostedFile.ContentLength;

// Allow only files less than 4194304 bytes (4 MB) to be uploaded.
if (fileSize < 4194304)
{
   //Do something
}


这篇关于上传限制是10MB以及如何在.cs文件中表示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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