halgatewood / file-directory-list

Free Super Clean PHP File Directory Listing Script
https://halgatewood.com/free/file-directory-list/
360 stars 151 forks source link

correct path on modal version #26

Open il-doc opened 4 years ago

il-doc commented 4 years ago

Hi to all, I maked an update to get it worked also on a modal windows. the problem was is the path, becouse on a modal windows you lose the path of the file, and you can't download it.

inside the Function display_block( $file ) I have added a line to retrive the path $absolute_path = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://" . $_SERVER["SERVER_NAME"] . '/' . trim(dirname($_SERVER["PHP_SELF"]),'/');

then I put the result inside herf just before $file

$rtn = "<div class=\"block\">"; $rtn .= "<a href=\"$absolute_path\$file\" class=\"$file_ext\"{$download_att}>"; $rtn .= " <div class=\"img $file_ext\">

"; $rtn .= " <div class=\"name\">";

what do you think?

Best regards Stefano