473,385 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Getting FileSize

Hi,


i have small problem. upload a file how to get the file size.


code:


private static string getFileName(HttpContext web, string fieldName)
{
try{
//HttpPostedFile file = web.Request.Files[web.Request["attachedFile"]];

HttpPostedFile file = web.Request.Files[fieldName];
if(file!=null) {

return System.IO.Path.GetFileName(file.FileName);
}else{
return "";
}
}catch(Exception e){
return "";
}
}


how to get file size in this function. pls give me any solutions
Mar 31 '08 #1
3 894
balabaster
797 Expert 512MB
Dim FileLength As Integer = New System.IO.FileInfo("FilePath").Length
Mar 31 '08 #2
Dim FileLength As Integer = New System.IO.FileInfo("FilePath").Length

Hi im using fileinfo("filePath") but not working. give sample code for getting the filesize for upload the text.
Mar 31 '08 #3
balabaster
797 Expert 512MB
Looking back over your code, it doesn't make sense to me - what are you trying to achieve?
Mar 31 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Phil Powell | last post by:
// PROCESS XML CONTENT INTO DYNAMICALLY-NAMED ARRAYS foreach (array('mime', 'state', 'country') as $val) { $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);...
2
by: IWP506 | last post by:
I just CANNOT figure out what is wrong with this! ------ $op1f = fopen("./test.txt","r"); $op1 = fread($op1f, filesize($op1f)); ------
4
by: Ken | last post by:
I would like to measure the fileSize of the image (without uploading it - php). I use: var size_pic = document.getElementById('num1').childNodes.fileSize; alert("size = " + size_pic); which...
3
by: Arjen | last post by:
Hello, When I have read a file with x.xxx.xxx.xxx bytes it is sometimes handy to show it in an diverent format than bytes. Is there a handy way to do this? Or is there a function for it? ...
0
by: manusatyam | last post by:
Hi, I have a problem here. I have a web application which dynamically creates a gif file and stores it in the root directory of the application. When I tried to open the file using the below...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.