Directories and Files questions?

Posted on 2003-03-06
Medium Priority
Last Modified: 2006-11-17
I am writing a file management program in PHP that lists the files of a certain file type in a named directory. Thsi directory has hundreds of files listed, What I want to do is to page the directory list to 20 or 30 file names per page.

I am using readdir to list the files.  The program also allows the user to select the listed files to Delete or Rename these files. Has anyone scripted anything like this?
Question by:parksmike
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

alfarod earned 400 total points
ID: 8087040

The best way to split a list in several pages is to put the list into an array and define this array as a session variable.
Then you can navigate from page to page just changing the subset you want to display.

You have this array $files
the page 1 shows from $files[0] to $files[19]
the page 2 shows from $files[20] to $files[39]
etc until the end of the array.


Expert Comment

ID: 8099239
you could also try an existing script!
take a look at phpMyExlorer
LVL 33

Expert Comment

ID: 11934099
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: alfarod {http:#8087040}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

EE Cleanup Volunteer

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question