开发者

List all names of files in a Web directory (uploads) using protocol HTTP

I'm trying to list all files (. DOC and. PDF) contained in a specific Web directory.

The problem is that I do not have access. I can only download with the full path of the file.

Example:

Directory 1: http://xxx.example.com/uploads/local20/40

Files:

45677.pdf

54354.doc

65767.doc

54354.pdf

43243.pdf

...

Directory 2: http://xxx.example.com/uploads/local20/41

Files:

45453.pdf

67566.pdf

89798.pdf

89898.doc

52254.pdf

...

I can manually download the files of directory 40 and 41, because I know your path, then write: http://xxx.example.com/uploads/local20/40/65767.doc (Download -> OK)

But how to download all the files contained in this directory without knowing the names of files? Or at least list the names of all files.

Obs 1: When I type only the directory (without the name of the file) it returns me an error in XML format. Ex: http://xxx.ex开发者_如何转开发ample.com/uploads/local20/40/

Response: XML Error

...

NoSuchKey

...

Obs2: The Web application use the PHP language.


In order to have the files in a folder listed out in html format when you browse to that folder with a web browser, you'll have to turn on directory browsing in your Apache configuration and make sure you don't have a default page (eg. index.php) in that folder. Don't forget to restart Apache after making the change.

BTW: If this is a folder where files can be uploaded, it really shouldn't be directly publicly accesible because you'll have a pretty major security vulnerability on your hands. Someone can upload a malicious PHP script and then run it by simply hitting the URL in a browser.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜