List all folders on my computer (php)

前端 未结 5 2164
一向
一向 2021-01-27 16:59

I want to browse all folders on my computer without using opendir(), in PHP.

相关标签:
5条回答
  • 2021-01-27 17:46

    I think I managed to extract the real question out of the comments: What you actually want is to provide an upload of multiple files.

    Answer: No this is not possible with PHP, since it is executed by the server, not by the browser. PHP can give you folders on the server, not on the machine of the user. If you want to upload multiple files in a single step, you should use flash, javascript or something similar.

    0 讨论(0)
  • 2021-01-27 17:51

    In one of the comments, seeming says:

    i want the user to select couple of files and upload rather than having multiple upload boxes. why are people downvoting this question?

    Well, it is because your question is unclear and it is impossible to answer without the context of multiple file uploads.

    The answer is: you can't do that with PHP. PHP runs serverside, so it can only give you a list of all the folders on the server; not the folders on the client side.

    So the solution you need will either be

    • a Java-Applet (Facebook uses this for multiple file uploads)
    • or Flash/Flex (Gmail multiple file upload)
    0 讨论(0)
  • 2021-01-27 17:53

    Why wouldn't you want to use the function that's actually provided to do what you want?

    0 讨论(0)
  • 2021-01-27 17:54

    The result will be a very ugly combination of glob() and stat(). Is there some reason you can't work with opendir() and friends?

    Edit:

    If PHP does not have suitable permissions to access everything you want to see, using another function is not going to help.

    What (exactly) are you trying to do?

    0 讨论(0)
  • 2021-01-27 17:58

    Why don't you use the following?

    opendir(DIRECTORY_SEPARATOR);
    
    0 讨论(0)
提交回复
热议问题