如何在asp.net中上传照片时限制高度,宽度和文件大小 [英] how to restrict height,width and file size when photo uploading in asp.net
本文介绍了如何在asp.net中上传照片时限制高度,宽度和文件大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在asp.net中上传照片时如何限制高度,宽度和文件大小
how to restrict height,width and file size when photo uploading in asp.net
pls help me
推荐答案
使用此检查:
Use this check:
using (Bitmap bitmap = new Bitmap(file.InputStream, false))
{
if (bitmap.Width < _MaxWidth && bitmap.Height < _MaxHeight)
_ValidImageDimension = true;
return ValidImageDimension;
}
以下链接可以帮助您:
http://cutesoft.net/developer+guide/index.htm#page=Restricting-image-uploads .htm [ ^ ]
http://stackoverflow.com/questions/1577413/asp-net-validate-file-size-width-and-height-before-upload [ ^ ]
http:/ /forums.asp.net/t/1085119.aspx?Resize+Images+on+upload [ ^ ]
Below links can help you:
http://cutesoft.net/developer+guide/index.htm#page=Restricting-image-uploads.htm[^]
http://stackoverflow.com/questions/1577413/asp-net-validate-file-size-width-and-height-before-upload[^]
http://forums.asp.net/t/1085119.aspx?Resize+Images+on+upload[^]
这篇关于如何在asp.net中上传照片时限制高度,宽度和文件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文