在asp.net的文件上传控件中验证以kb为单位的图像大小[英] validate image size in kb in file upload control in asp.net

本文是小编为大家收集整理的关于在asp.net的文件上传控件中验证以kb为单位的图像大小的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

如何验证在 asp.net 文件上传控件中上传的图像必须小于 700 kb.没有 web.config 方法.或者如果来自 web .config 方法,请给出错误 handler.thanx

推荐答案

图像大小.

在上传到服务器之前

你不能.

上传到服务器后

FileInfo fno = new FileInfo("c:\\test.txt");
                        //length in bytes
                        long bytes = fno.Length; 


谢谢
--RA

本文地址:https://www.itbaoku.cn/post/1394752.html

问题描述

how can i validate that image being uploaded in asp.net file upload control must be less than 700 kb . without web.config method .or if from web .config method ,please give error handler.thanx

推荐答案

Image size.

before uploading to the server

you can''t.

After upload to the server

FileInfo fno = new FileInfo("c:\\test.txt");
                        //length in bytes
                        long bytes = fno.Length; 


Thanks
--RA