Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with filesize in my script

Status
Not open for further replies.

4x4uk

Technical User
Apr 30, 2002
381
0
0
GB
I have a script which reads info from a directory on the server, but what I can't understand is why filesize only shows the info for one file and none of the others. If I delete that file nothing shows at all, the script is listed below if someone could point out what I am doing wrong I would be grateful
Code:
$handle = opendir('Download');
while (false !== ($file = readdir($handle))) {
//files to ignore
if ($file != "." && $file != ".." && $file != "consultation.doc"  && $file != "dir.png"  && $file != "size.png"  && $file != "type.png" && $file != "req.png"){
//separate filename from file extension
$fsplit=explode(".",$file);
$fname=$fsplit[0];
$fext=$fsplit[1]
//output information
echo "<tr><td>$fname</td><td>$fext</td>";
echo "<td>".filesize($file)." Bytes</td></tr>";
}}
clodedir($handle);

Infinity exists! - I just haven't worked out a way to get there yet.

 
Just to ask the dumb question....

The entries in your directory...they are files and not themselves directories, right?

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Definately files 3 x pdf of varying size and 1 x zip , the directory was set up purely to test

Infinity exists! - I just haven't worked out a way to get there yet.

 
for consultation.pdf 119529 (the actual filesize)
for the other2 pdf's nothing and for the zip file nothing
The weird thing is if I delete consultation.pdf no file sizes are listed

Infinity exists! - I just haven't worked out a way to get there yet.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top