Sure that can be done with php...
Two ways I can think of:
Put those files in directories not accessable from the internet. And to download "file.doc" make a php code that would look something like this:
/download.php?file=file.doc
So then the php would get the file from the directory hidden outside users (Ex: /home/user/secretdir/) and send it to the user. Of course, after verifying the the person trying to access the file is logged in.
OR
You can put all files in a mysql database and then get the file in a similiar way when requested...
I'd suggest the first method