Nov 22, 2009

Directory Files Displaying

free web hosting
Open Discussion > MODERATED AREA > Computers > Programming Languages > PHP Programming

Directory Files Displaying

itssami
I have many files in a directory..I want to create a page , like
A B C D E F .....
when some one click on A , it should display all the files starting from letter A , and when clicks on B , it should show all the files in that directory starting from B , and so on... I have no idea how to display the files of the directory iin that way.
Kindly assist me..

Comment/Reply (w/o sign-up)

farsiscript
You can make That with SQL database and files url
You can make one page with search query with "a" or "b" or "c" or ....."z"
when your users click at "a" your php code must go and file A files in database and sort it for your user .
or You can make these files with statics search guery
a.php , b.php , c.php , d.php , e.php ,
When Your user click at "A" You must link at a.php


Comment/Reply (w/o sign-up)

jlhaslip
Ittsami,
My suggestion would be to:
Begin by building an array of the letters of the alphabet (a-z) and producing the list of links that would select the letter. (maybe a pull-down listbox?)
Then use that letter as a search/sort criteria of the directory list. Write the file names into another array, then sort the array, then echo the list using a function similar to the one which you have been earlier provided with to list file names from a directory, except this time, use the array of filenames as the function source rather than the directory contents.
A Database would not be required if there were only a small list of files, but it would be faster to use the Database approach as suggested above if there were lots of files in the Directory.

Comment/Reply (w/o sign-up)

Inspiron
It's done... I've sent the files to you.. Check out for bugs and let me know.. smile.gif

Also, with regards to the replies above, I would like to point that there isn't a need to use a database. In fact, having a database isn't efficient when there is a whole lot of files added to the directory, and you will have to update the database. If a hundred connections are accessing the directory, the database will have to undergo maintanence very often when each connection changes the directory structure. In fact, I've remade a script done by itssami to use only itself, 1 file, to handle the directory structure without the need of using a database or a requirement of a 2nd php file. This way, it's alot more easier for debugging and administrating his web site.

Comment/Reply (w/o sign-up)

jlhaslip
So could you post the code here so we can all benefit?

Comment/Reply (w/o sign-up)

Inspiron
QUOTE(jlhaslip @ May 15 2006, 12:38 AM) *

So could you post the code here so we can all benefit?

I'll leave it to itssami to decide if he want's to release the source codes..

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : Directory Files Displaying

  1. How To Sort Files Of A Directory using Php - (13)
    The following code displays the files of folder...but they are displaced by the order of adding... i
    want to sord the files / folders alphabetically and sord by accending order and by decending
    order.. can some one help me. $path = ""; $dir_handle = @opendir($path) or die("Unable to open
    $path"); echo "Directory Listing of $path "; while($file = readdir($dir_handle)) {
    if(is_dir($file)) { continue; } else if($file != '.' && $file !=
    '..') { echo " $file "; } } //closing the directory
    closedir($dir...
  2. Php Ftp Upload Form - Adding User Directory to PHP Upload Form - Help (2)
    Alright I am trying to have a PHP FTP Upload Form that allows the user to create the directory
    folder for where they want to upload there files to. example: Main Directory: vainsoft.com There
    directory: vainsoft.com/modeling or vainsoft.com/photography But I dont want them to be able to
    upload things into the main directory, only sub-directories, is that possible with this coding that
    I have: CODE //uses $_FILES global array //see manual for older PHP version info //This
    function will be used to get the extension from the filename function get_extension($file,$...
  3. How To Display Images Of A Directory - (5)
    I am trying to do a simple thing. I want to display all the images of a directory on a single page
    with the checkbox next to each image, so that i can select multi images and i can delete selected
    images. Following few lines of code display the images of a directory.. i need help to put the
    check boxes with each image. and I dont understand how can i select multi images with check box and
    then delete them. I hope someone can help. thanks. CODE $path = "./"; $dir_handle =
    @opendir($path) or die("Unable to open folder"); while (false !== ($file = readdir($dir_han...
  4. Securing Upload Directory - proper way to do it? (6)
  5. Php - Fetching Random Line From A Text File - and displaying it using AJAX/iframe (0)
    What you should know: HTML, PHP basics (executing php scripts) Examples: Using AJAX Using
    iframe Download Examples Using this script you can display a random quote/fact every time a
    visitor clicks the link. It happens dynamically without reloading the whole page. Useful for keeping
    a site fresh and lively. For example, you can have it in "About Me" page of a website which is
    rarely updated. All the quotes are stored in a text file separated by a line break. Although I have
    included a sample collection, you are free to modify or create your own. Thanks to Davi...
  6. Getting List Of Directories And Files Using Php - PHP Function for Directory and File List (6)
    is there a php function that lists the content of some folder.... example: /New folder new.txt
    left.gif download.zip dc.exe ....so is there..? /rolleyes.gif' border='0'
    style='vertical-align:middle' alt='rolleyes.gif' /> ...
  7. Need Some Help In File Browser - listing all sub folders and files in them. (8)
    Hey I want to create a very simple file browser, so that, it reads all the sub-folders which are
    places in a directory, and the files inside the sub-folders (It reads only files inside sub-folders
    and list them in simply. ) Also, it creates a directory (any name) inside each sub folder. My
    Following code reads on the files inside the main directory, it does not read the files inside the
    sub-folders.. I appreciate any help. CODE $path = "./"; $dir_handle = @opendir($path) or
    die("Unable to open $path"); while ($file = readdir($dir_handle)) { if($file == "." || $fil...
  8. Download Script For Mp3 Files - (0)
    Hello, I'm looking for a download script for sound files (e.g. mp3, avi, wma, and other ones).
    i have found a few download scripts but they would not work for sound files for some reason. also
    this will not be used for allowing downloading of illegal or riped music, what i will be using this
    script for is i'm making a site for my church and the pastor wants to be able to recored the
    services and then have me upload them to the site so that the church members can download them for
    what ever reason. If some one could tell me how to make one or could show me a plac...
  9. Change Permission With Php Code - code to change files' and folders' permissions? (3)
    As everyone know, there two ways (that I can think of) to change files' and directories'
    permissions. One is to change it in your cPanel's Disk Manager and the other is with an FTP
    client that supports chmod. Well, I'm doing something for my site that requires files to have
    full permissions (Execute, Write, and Read on all three groups). At first, I thought that if I made
    the directory 777, then every file created in that directory will be 777 as well. I'm wrong. An
    alternative to doing this is to change each file permission myself, but that would be...
  10. Displaying 10 Records Per Page - (5)
    how to display 10 messages per page? CODE     include("config/config.inc.php");
        include("config/dbcon.php");     include("checksession.php");              if(isset($_POST )){
            $gname = $_POST ;         $gemail = $_POST ;         $gmsg = $_POST ;         $date =
    date("m.d.y"); $sql = "insert into tblguestbook "; $sql .= "(guestname, guestemail, guestmessage,
    guestdate)"; $sql .=" values('$gname','$gemail','$gmsg','$date')";
        mysql_query($sql);     } ?> My Guestbook body {     background-color: #000000;
    }...
  11. Displaying Date And Time (gmt+8) - (5)
    how to display date and time (gmt+8)? any help would be appreciated....
  12. Grabt Access To My Protected Files - grabt access to my protected files (2)
    Hi all, I am sure all of you are great programers but First i am no code programmer i am just
    trying to learn to run my sites, will the problem is i got a code from the web to protect my files
    ,1st i want to know how to work it out then i will try other things but can't let it go without
    a fight thanx all php: CODE if ( ! defined( 'myname' ) ) {         print "You
    cannot access this file directly.";         exit(); } customer data here ?> now i
    can't access my files what is the method to access them all i want is to protect the f...
  13. Security Issue Writing Files - Security issue writing files (1)
    Hi, first, sorry about my english. i am a beginner with php and i have some question about writing
    files using php in a shared hosting. is a risk?, use database to store data is a better way? i just
    want make an interface (in php) that write the data in a .html extension file to show to everybody
    the html page and just the php interface is to the content manager. thanks in advance ...
  14. Displaying Your Phone Number On A Wap Site - (3)
    I have a wap site elitezone.co.za and what i want to add is a code to the index page that displays
    your operator and phone number. Does any one know the coding for this function if so please show me
    here. Help will appriacated. Topic title modified. ...
  15. Unofficial Trap17 Hosted Members Directory - (13)
    This is the Trap17 edition of the Hosted Members Directory. A script initially written by me for the
    Astahost forums. The script has gone through many a changes and is currently in version 4 which
    includes the following features:- > Listing of hosted members. > Listing of the websites of the
    hosted members. > Validation of the websites (whether the site is suspended, working or not not
    working, etc) > Save/Load result to/from database. > Multithreaded for faster operation. > Status
    messages, images and progress bar to keep you informed of the process. Link to the Scrip...
  16. [php]simple Flat File Text Manipulator - Example on how to use forms to write to files in PHP (3)
    I made a simple flat file text editor, that can show you probably how simple it is to use forms with
    php and write that data to file. This example has 2 files, submit.php, and postit.html. Submit.php
    is used to write title, and some text, and add html tags, and paragraph tags where new paragraphs
    are. Here's the file with comments. I think that HTML really doesn't need some more
    explaining. CODE Title: Text: if (@$_POST =="" || @$_POST
    ==""){      echo "Enter text to save!"; } else {      //this is path to file      $filena...
  17. Forms, Text Files, And Php For A Signature Generator. - Help a little. (1)
    Hello everyone! I am in need of some code a for a signature generator I am making. I am using
    BuffaloHELP's code for the php file, now I am trying to improve that code by making a form in a
    html file that will have the user say what is on the sig! But now, I need help getting the form data
    that is posted by the user to get into that sig! There is a file, sig.txt, where that tells the php
    file what text will go on the sig. But how can I make the form data in the html file go into the
    text file so it will go onto the sig? You might want to read BuffaloHELP's code. ...
  18. Reading Files From Directory To Array, And Using $_get To Get Them - Simple way to manage lot's of files (2)
    Some user posted a similar problem i had when i tried to figure out how to update content on my
    website in less work as possible. This is just part of the "big" plan i have for my site but it can
    be helpfull to you guys if you like FlatFile. I hope that mod's don't mind me posting the
    same code here and on their forums, couse if they do i'll delete it from their forums
    /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> So
    here's the situation. Let's say you have a folder called 'myfilesdirectory' on your
    s...
  19. Writing To Files And Such - (3)
    Ok lets say i have a config.php file, i want to edit something without open it, i know every line
    number and that, now how would i do this? I will show you a example: CODE $CONFIG
                =    'root'; $CONFIG         =    'localhost'; $CONFIG
                =    '******'; $CONFIG             =    '******'; $CONFIG
            =    '1'; $CONFIG             =    'en'; ?> Now lets say i want to
    change $CONFIG , HOW would i do this without open the file? Thanks /smile.gif"
    style="vertical-align:middle" emoid=":)" bor...
  20. Help Needed With Directory/file Listing Code Infinite Loop - Made an infinite loop but why is this so? (5)
    Hi all ive got a small and simple (for the moment atleast /unsure.gif"
    style="vertical-align:middle" emoid=":unsure:" border="0" alt="unsure.gif" /> )file and directory
    listing script in php as follows CODE $dir = "."; $num = 0; $file = scandir($dir); while($file
    = scandir($dir)){     echo $file ;     echo " ";     $num = $num + 1;      }; the concept is
    simple enough, the directory to start with is the current one, so scan this directory and while we
    have a result do a loop to echo the file/directories found, incriment the array number by one so we
    get the...
  21. Files Required? - (5)
    I want to learn php and I am already on the first steps to doing it. I have set up my server using
    easyPHP as well as XAMPP which is a package containing FileZilla, Apache and MySQL. Other than
    easyPHP, XAMPP and MySQL, what other softwares are required to be set up for me to successfully
    learn how to program with PHP?...
  22. Display Random File In A Directory - how to display a random file from a set directory. (9)
    hi, could someone please help me with this? I have some files in a directory and i want to know how
    i can randomly display link/s to one or more of the files in my directory for download. But it must
    not at any time display index.php which is also in the directory with the downloads. Thanks in
    advance for any help given /unsure.gif" style="vertical-align:middle" emoid=":unsure:" border="0"
    alt="unsure.gif" />...
  23. Changin My Phpnuke Directory...please Help - (13)
    ok i wus fantastico to install my nuke...it asked me to give it a name for its directory so ive put
    down "nuke" so to get to my site ud have to go to www.boaw.trap17.com/"nuke" but now i want to
    change nuke into something else more related to the site...i was wondering if any1 can tell me the
    best way to do that...thanks...
  24. Displaying Files Of A Directory - (2)
    I want to display the contents of a directory.. i have the following code.. It gives the output in
    one column only... like file1 file2 file3 file4 . . . . . Since there are lot of files so this
    column gets very long..i want to display the x number of files in each column.. like if there are 22
    files.. then file 1 file 11 file 21 file 2 . file 22 file 3 .. . . . file 10
    file 20 This was just an example..I know it can be done by using but i dont know how to do it
    with loop. Please help me. QUOTE $dir = './'; $handle = opendir($...
  25. Logging Dowload Files From Your Server Onto A Html File - (1)
    Well, i had the idea of logging the downloads from my web in a html file few weeks ago, and i solved
    it with a lil php page included in my homepage. You could name the links with a name like
    "download.php?file=filename.ext" and then, in the download.php put the next code: (well you put
    the html and head and body tags if u want, i only write the php here) CODE if (isset($_GET ))
    $file=$_GET ; //so it gets the GET data from url (file=filename.ext); $ip=$_SERVER ;
    $file=fopen('download_log.html','a'); $date=date('d-m-y H:i:s'); $text="
    ".$...
  26. How To List Files In A Directory + Subdirectory And Then Use Them. - (8)
    So lets say i have folders called friends and work in a folder called pics. how would i make a
    function that lists the files in those folderscalled images kinda like this: CODE
    $directory = "./" function listfiles($directory) { //here should go the script to list the files in
    those directories. so that i can continue to work with them. like for example if there were images
    it would list all  the images and i could write a script to make a thumb of them and then save it
    into a thumb folder(not asking for all of that). but how would i make it list it. // basic...
  27. Displaying Latest Added Files Of Subdirectories ? - (5)
    For example,i have a directory , which has 3 sub directories a,b and c...and i have some files in
    all subdirectories.. is it possible that i can display the latest added files to any of sub
    directory a,b, or c.?i think i will have to use sort by date function but how it should be done that
    it compares the files of all the subdirectories directories ?...
  28. What Kind Of Files Are .lib - (2)
    I want to know , if we use some pre-made php script , there are often many files with other
    extension..i have been watching many times some files names ".lib" . what kind of files these are
    ... there's written C/C++ inline file.. why these kinds of files are needed in php scripts.. and
    are there some replacements for it ? (So that we can do things without it ?)... for example im
    pasting the coding of a file.. ban.lib ..i want to ask, why it is .lib file..why it cant be .php....
    CODE function file2str($p){if($p=="") return ""; $f=@fopen($p,"r");if(!$f) return ""...
  29. Here's A Nice And Interesting Way To Make Comments - In your php files (9)
    We all know that when we make websites, sometimes, we just don't want a code to be there... for
    now. What I'm saying is, for example: Your name is Bob. Yes it's Bob. Bob made a website
    and added lots of content. He gets a lot of traffic. He signs up for Google Adsense! Yay! He is
    happy. He makes thousands of dollars a month. He is famous. And that is the exact reason why your
    enemy, Angela, is trying to make your google adsense account bad. Guess what? Angela is your
    sister. Yes she is your sister. What does that mean? She uses the same IP address as you....
  30. I Need Help With Wordpress/php - I am lost with these files! (7)
    Okay, here is the story. I set up wordpress on my site. I know nothing about PHP and need help. I
    need to know where the url and title info is stored. I checked in the header PHP file, and all I
    saw was: CODE And "> Where is the URL and Title stores in PHP. I would
    like to be able to edit them. I found everything else and get the BASIC idea. But PHP is very
    complex it seems. Could you help me out guys? Thanks! Altered Topic Title to better describe the
    topic ...



Looking for directory, files, displaying
How To Sort
Files Of A
Directory
using Php
Php Ftp
Upload Form
Adding User
Directory to
PHP Upload
Form - Help
How To
Display
Images Of A
Directory
Securing
Upload
Directory
proper way
to do it?
Php -
Fetching
Random Line
From A Text
File and
displaying
it using
AJAX/iframe
Getting List
Of
Directories
And Files
Using Php
PHP Function
for
Directory
and File
List
Need Some
Help In File
Browser
listing all
sub folders
and files in
them.
Download
Script For
Mp3 Files
Change
Permission
With Php
Code code to
change
files'
and
folders'
permissions?
Displaying
10 Records
Per Page
Displaying
Date And
Time (gmt+8)
Grabt Access
To My
Protected
Files grabt
access to my
protected
files
Security
Issue
Writing
Files
Security
issue
writing
files
Displaying
Your Phone
Number On A
Wap Site
Unofficial
Trap17
Hosted
Members
Directory
[php]simple
Flat File
Text
Manipulator
Example on
how to use
forms to
write to
files in PHP
Forms, Text
Files, And
Php For A
Signature
Generator.
Help a
little.
Reading
Files From
Directory To
Array, And
Using
$_get
To Get Them
Simple way
to manage
lot's of
files
Writing To
Files And
Such
Help Needed
With
Directory/fi
le Listing
Code
Infinite
Loop Made an
infinite
loop but why
is this so?
Files
Required?
Display
Random File
In A
Directory
how to
display a
random file
from a set
directory.
Changin My
Phpnuke
Directory...
please Help
Displaying
Files Of A
Directory
Logging
Dowload
Files From
Your Server
Onto A Html
File
How To List
Files In A
Directory +
Subdirectory
And Then Use
Them.
Displaying
Latest Added
Files Of
Subdirectori
es ?
What Kind Of
Files Are
.lib
Here's A
Nice And
Interesting
Way To Make
Comments In
your php
files
I Need Help
With
Wordpress/ph
p I am lost
with these
files!

Searching Video's for directory, files, displaying
See Also,
advertisement


Directory Files Displaying

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com