php - Unable to display pdf on android localhost -
i've been using ksweb's phpfilemanager tool host images on android tablet while , have tried expand capacity .pdf files. unfortunately given file manager opens in browser on android, unable view pdfs.
since local, using google docs doesn't work , when try view in alternative browser such dolphin pdf viewer plugin, displays blue box question mark inside apparently indicates file unable found.
here's code i'm using in localhost reference.
<head> <title> title goes here </title> <?php $a = array(); $dir = 'filenameinphpfilemanagerdirectory'; if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if (preg_match("/\.png$/", $file)) $a[] = $file; elseif (preg_match("/\.jpg$/", $file)) $a[] = $file; elseif (preg_match("/\.jpeg$/", $file)) $a[] = $file; elseif (preg_match("/\.pdf$/", $file)) $a[] = $file; } closedir($handle); } foreach ($a $i) { echo "<img src='" . $dir . '/' . $i . "' />"; } ?>
Comments
Post a Comment