.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Get File Size in ASP.Net

Posted By: Narayanan     Posted Date: September 13, 2011    Points:5   Category :ASP.Net
Hi,
I am using asp:FileUpload in Testing Project.I saved One location to another location using Fileupload.But I got a file Contentlength.But it is KB, MB,GB .How can i do this?
This is my Code
if (File_upload.HasFile)
{

try
{

string FileName = Path.GetFileName(File_upload.FileName);
File_upload.SaveAs(@"D:\" + FileName);
lblTest.Text = "File Uploaded with File Size :" + File_upload.PostedFile.ContentLength;



}
catch (Exception ex)
{
lblTest.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
}
}
Regards,
Lakshmi Narayanan.S


Responses
Author: Sasi Prabhu             
Posted Date: September 13, 2011     Points: 20   
Author: Narayanan             
Posted Date: September 13, 2011     Points: 20   

Hi,
Thanks

Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend