im stuck and need a solution :(

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ogelami
Forum Newbie
Posts: 1
Joined: Tue Mar 18, 2008 1:32 pm

im stuck and need a solution :(

Post 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? :)
scriptah
Forum Commoner
Posts: 27
Joined: Sat Mar 15, 2008 8:58 pm
Location: Long Island, NY

Re: im stuck and need a solution :(

Post 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?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: im stuck and need a solution :(

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply