Page 1 of 1

im stuck and need a solution :(

Posted: Tue Mar 18, 2008 1:37 pm
by ogelami
i think im stuck here, i need a solution for my project.
i want a possibility to view the files without downloading them by clicking them, and ability to view folders.

Code: Select all

<?php
$dir = new DirectoryIterator( '.' );
foreach($dir as $file ){
if(!$file->isDot() && !$file->isDir()); {
echo "FileName: <a href='".$file->getFilename();
echo "'>" .$file->getFilename();
echo "</a>";
echo "<BR/>";
echo "Size: ".number_format(($file->getSize()/1024),2)." Kb";
echo "<BR/>";
echo "Date Created: ".date("D d M Y H:i:sa",$file->getCTime());
echo "<BR/>";
echo "<BR/>";
}
}
echo "<a href='index.php'>Back.</a>"
?>
any one got a solution? :)

Re: im stuck and need a solution :(

Posted: Tue Mar 18, 2008 2:16 pm
by scriptah
About displaying directories ...

Code: Select all

 
if(!$file->isDot() && !$file->isDir()); {
 
You should remove the second condition.

I didn't understand what you meant by "viewing the file without downloading them".
Which types of file are you going to display?

Re: im stuck and need a solution :(

Posted: Tue Mar 18, 2008 3:01 pm
by pickle
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.