如何通过c#计算一秒钟内要下载的文件大小 [英] how to calculate the size of file to be downloaded in one second by c #

查看:264
本文介绍了如何通过c#计算一秒钟内要下载的文件大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以帮我如何通过c#计算一秒钟下载文件的大小而不是她(我需要代码)!!!谢谢

anyone can help me how to calculate the size of file to be downloaded in one second by c # not she (I need code) !!!thank

推荐答案



试试这段代码。

Hi
try this code .
// Get file size
long size = fi.Length;
Console.WriteLine("File Size in Bytes: {0}", size);


使用 HttpPostedFile.ContentLength属性 [ ^ ]获取上传文件的文件大小。

如果您的 FileUpload 控件名称为 Fileupload1 ,然后您可以使用以下方式获取大小:

Use HttpPostedFile.ContentLength Property[^] to get the file size of the uploaded file.
So say if your FileUpload control name is Fileupload1, then you can get the size using:
FileUpload1.PostedFile.ContentLength





希望这有帮助!



Hope this helps!


这篇关于如何通过c#计算一秒钟内要下载的文件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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