Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
,
<%# GetFileLength(Container.CurrentPage["varFilePath"].ToString())%>
aspx.cs
public string GetFileLength(string FilePath)
{
string _getFileInfo = "";
try
{
FileInfo finfo = new FileInfo(Server.MapPath(FilePath));
long FileInKB = finfo.Length / 1024;
_getFileInfo = FileInKB.ToString();
}
catch (NotSupportedException)
{
}
catch (ArgumentException)
{
}
catch (IOException)
{
}
catch(HttpException)
{
}
return _getFileInfo;
}
ascx <%# getfilelengthcontainer.currentpage> kb ascx.cs public string GetFileLength(PageData pdFileInfo) { FileInfo fi = new FileInfo(pdFileInfo.Property["varFilePath"].ToString()); return fi.Length.ToString(); } %#>
Any better ideas anyone? Thanks. Victor