GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 11-Nov-2004, 14:15
dopee dopee is offline
Awaiting Email Confirmation
 
Join Date: Feb 2004
Location: south africa
Posts: 109
dopee will become famous soon enough

reading files/folders


I'm trying to create a script that acts as a file manager for users to view/add files into their allowed directories. But there's sommin seriously wrong with the the reading of directories portion...what am i doing wrong?
The following is where the problem occurs. If there are no directories in the current directory then it executes fine, whereas if php tries to view a folder/add it to the array, it gives an error. How can I list both the directories and files found in the directory specified?
PHP Code:

<?php
$dir = "temp/temp2/";
$emptydirectory = true;
$PHP_SELF = "index.php";
$filecount = 0;
$filelist=array();

if (!is_dir($dir))
{
     print "Directory does not exist";
     return(false);
}
while (($file = readdir($dh)) !== false)
{
         $fileinfo = pathinfo($file);
         array_push($filelist,$file);
         $filecount ++;
}
print "<form method=\"post\" enctype=\"multipart/form-data\" action=\"$PHP_SELF\" name=\"editfile\" onsubmit=\"return formCheck(this);\">";
// rest of form etc
?>

 
 

Recent GIDBlog2nd Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
reading the result of an external command Mr B C Programming Language 3 30-Oct-2004 06:51
Problem reading structs in a file The_Kingpin C Programming Language 16 26-Oct-2004 23:07
warning cannot open 'extra/browscap.ini' for reading allelopath Apache Web Server Forum 1 08-Sep-2004 05:22
reading a char* into struct data spike666 C Programming Language 7 19-Apr-2004 12:06
reading a file twice stevies24 C Programming Language 3 14-Apr-2004 17:31

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 04:28.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.