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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.