How can I upload files to a folder on the server or into a database and then allow the user to view all files via a webpage?
File Upload
If you need to find out how to handle file uploads check out the docs.
To create an index page you could let Apache do it for you by simply making the upload directory somewhere underneath Apache's document root and providing a link to it.
Or you could do it yourself. You'll need to make use of the filesystem functions and directory functions (see particularly peterdolan's comment on listing directory trees as associative arrays on the directories page).