I use php files in my website and in those file I include my html to show whatever i want the user to view. However i’ve ran into a problem. I need to show a list of available downloads from a specific folder from my website. The uploading downloadables from my website works. The reading files from directory works, this is done using php code. Now the thing is how can I show this in my html, how to I show this to my user in a fashion that i like most, like for example how Dropbox shows their file listing something like that.
The thing is to pass those files found within the PHP file and pass them to the html to be able to work with them however I want.
I hope i am clear, in case please just tell me so I can elaborate more.
Thanks.
Some code as requested, this is how I am supposedly extracting my files from my website’s directory…
Ahh something like this, i get the idea, but here is my problem…
my code looks like this…
$directory_mine;
if ($directory_mine = opendir('/path/to/files')) {
//This is for testing.
echo "Directory: ". $directory_mine . "\n";
echo "Entries:\n";
while (false !== ($entry = readdir($directory_mine))) {
//should be writing each file name into the html here. at least thats my thinking.
}
closedir($directory_mine);
}
include("overall_header.html");
include("mobiledownloadview.html");
include("overall_footer.html");
See here is the problem, how can i add the data extracted by my php file to the mobiledownloadview.html???
I believe this is one way to do it, but if this is terrible please tell me. is there a better way to acomplish my goal?
From the manual on
readdir:If you want to style it, wrap it in an (un-) ordered list and use css for that.