Previous Thread
Next Thread
Print Thread
Rate Thread
#102646 05/10/2005 8:52 AM
Joined: May 2000
Posts: 1,356
Addict
Addict
Joined: May 2000
Posts: 1,356
no problem... but you need to swap "Date:" "Size:" texts smile and... I can give you a byte converter smile

Code
sub fsize {
my $size = shift or return '0 byte';
return sprintf("%1.2f %s",$size / 1024 / 1024 / 1024, " GB" ) if($size >= 1024*1024*1024);
return sprintf("%1.2f %s",$size / 1024 / 1024 , " MB" ) if($size >= 1024*1024 );
return sprintf("%1.2f %s",$size / 1024 , " KB" ) if($size >= 1024 );
return sprintf("%1.2f %s",$size , " Byte") if($size < 1024 );
return "$size Byte";
}
so, you can use it like:

Code
opendir(UPLOADS, "$opt{dir}/$user_number") or die "Can not opendir($opt{dir}/$user_number): $!";
my @uploads = readdir(UPLOADS);
closedir(UPLOADS);
my($size, $mtime);
foreach my $filename (@uploads) {
next if $filename =~ /^./; # ignore anything that starts with a dot. like "." ".." ".htaccess"
next if -d "$opt{dir}/$user_number/$filename"; # ignore directories
($size, $mtime) = (stat "$opt{dir}/$user_number/$filename")[7,9] or die "Error: $!";

##output it
$size = fsize($size);

print qq(
<tr valign="top">
<td bgcolor="$vars_style{AltColumnColor2}" align="center" width="20"><input type="checkbox" name="$key" value="include" checked="checked" /></td>
<td bgcolor="$vars_style{AltColumnColor2}"><b><font size="$vars_style{FDTextSize}">$filename</font></b></td>
<td bgcolor="$vars_style{AltColumnColor2}" align="center" valign="middle">$size</td>
<td bgcolor="$vars_style{AltColumnColor2}" align="center" valign="middle">$mtime</td>
</tr>
);
}

Sponsored Links
Entire Thread
Subject Posted By Posted
Regular Expressions HelloWorld 04/22/2001 7:57 AM
Re: Regular Expressions Mark Badolato 04/22/2001 8:31 AM
Re: Regular Expressions HelloWorld 04/22/2001 8:46 PM
Re: Regular Expressions HelloWorld 04/22/2001 8:58 PM
Re: Regular Expressions Dave_L 04/23/2001 1:15 AM
Re: Regular Expressions HelloWorld 04/23/2001 3:27 AM
Re: Regular Expressions HelloWorld 04/23/2001 4:01 AM
Re: Regular Expressions AllenAyres 05/09/2005 8:24 AM
Re: Regular Expressions AllenAyres 05/09/2005 9:48 PM
Re: Regular Expressions Burak 05/09/2005 10:10 PM
Re: Regular Expressions AllenAyres 05/09/2005 10:34 PM
Re: Regular Expressions Burak 05/09/2005 10:48 PM
Re: Regular Expressions AllenAyres 05/09/2005 11:16 PM
Re: Regular Expressions Burak 05/10/2005 12:07 AM
Re: Regular Expressions AllenAyres 05/10/2005 8:16 AM
Re: Regular Expressions Burak 05/10/2005 1:52 PM
Re: Regular Expressions AllenAyres 05/10/2005 3:16 PM
Re: Regular Expressions Burak 05/10/2005 3:52 PM
Re: Regular Expressions Burak 05/10/2005 3:57 PM
Re: Regular Expressions AllenAyres 05/10/2005 6:18 PM
Re: Regular Expressions BLESSY JOSE 09/15/2005 3:40 PM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)