Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8219275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:05:52+00:00 2026-06-07T13:05:52+00:00

(Well what I gone through a lot of posts here on stackoverflow and other

  • 0

(Well what I gone through a lot of posts here on stackoverflow and other sites. I need a simple task, )

I want to provide my user facility to click on upload file from his account, then select a directory and get the list of all the files names inside that directory.

According to the posts here what I got is I have to pre-define the directory name, which I want to avoid.

Is there a simple way to click a directory and get all the files names in an array in PHP? many thanks in advance!

  $dir = isset($_POST['uploadFile']) ? _SERVER['DOCUMENT_ROOT'].'/'.$_POST['uploadFile'] : null;
  if ($_POST['uploadFile'] == true) 
    {
     foreach (glob($dir."/*.mp3") as $filename) {
     echo $filename;
    }
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:05:54+00:00Added an answer on June 7, 2026 at 1:05 pm

    I will go ahead and post a sample of code I am currently using, with a few changes, although I would normally tell you to look it up on google and try it first.

    if ($handle = opendir($dir)) {
        while (false !== ($file = readdir($handle))) {
            echo $file;
        }
        closedir($handle);
    }
    

    This will display the entire contents of a directory… including: “.”, “..”, any sub-directories, and any hidden files. I am sure you can figure out a way to hide those if it is not desirable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Perl as well as Flex. I've just gone through the basic
I've gone through the other answers for this kind of question, nothing has really
First of all, I have gone through all the questions here regarding the inclusion
I'm following the tutorial here : I've gone through all the steps. My app
I've been reading through the other posts on this topic tried what was suggested
I have gone through this question, it works well with its own case using
currently using jq 1.4.2 And i have gone through this forum and other forums
Well, the title pretty much states it. I want to be able to draw
Well, i want house image to rotate from -5° to 5° and i wrote
From my previous question for selecting specific html text, I have gone through this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.