Jump to content

viewing pdf's


jakebur01

Recommended Posts

How could I have php pull pdf's with a certain name?

 

Ex. If their policy number is 68402. And I have "58692.12-23-2007.documentname.pdf" , "68402.11-12-2007.documentname.pdf", etc...

 

It would only pull the 68402.11-12-2007.documentname.pdf. I wanted it to seperate the policy number and date from the .pdf name then only display links to the .pdf's associated with their policy number.

 

Thanks,

 

Jake

Link to comment
https://forums.phpfreaks.com/topic/98579-viewing-pdfs/
Share on other sites

how could I make it break off the policy number from the file name and search for .pdf's according to that using the function below? It would be the number in front of the first period. (Ex. 485743.documentname.pdf)

 

function browsepdf(){
    $pdffile=glob("printable/*.pdf");
    rsort($pdffile);
    foreach($pdffile as $filename){
        $filename=ltrim($filename, "printable/");
        $filename=rtrim($filename, ".pdf");
        $file=$filename;
        $datetime=strtotime($filename);
        $newdate=strtotime("+3 days",$datetime);
        $filenamedate=date("F d", $datetime);
        $filenamedate.=" - ".date("F d, Y", $newdate);
        echo "<option value='$file'>$filenamedate</option>";
    }
}

Link to comment
https://forums.phpfreaks.com/topic/98579-viewing-pdfs/#findComment-504624
Share on other sites

So you just want to return files with that policy number at the beginning?

 

<?php
function browsepdf($policy){
    $pdffile=glob("printable/$policy*.pdf");
    rsort($pdffile);
    foreach($pdffile as $filename){
        $filename=ltrim($filename, "printable/");
        $filename=rtrim($filename, ".pdf");
        $file=$filename;
        $datetime=strtotime($filename);
        $newdate=strtotime("+3 days",$datetime);
        $filenamedate=date("F d", $datetime);
        $filenamedate.=" - ".date("F d, Y", $newdate);
        echo "<option value='$file'>$filenamedate</option>";
    }
}
browsepdf(485743);
?>

Link to comment
https://forums.phpfreaks.com/topic/98579-viewing-pdfs/#findComment-504633
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.