Hi
Please tell me how we can search PDF File , which is stored in folder
like C:\Folder
and then show in
show.php page as dynamic link.

also Upload new PDF File to Folder

Please tell me how?

__avd commented: Good question. +6

Recommended Answers

why you want to search for the pdf file through php, if you know the path and the file name both?
If you have both, you can simply get it as like other files using fopen etc

Jump to Post

All 4 Replies

why you want to search for the pdf file through php, if you know the path and the file name both?
If you have both, you can simply get it as like other files using fopen etc

why you want to search for the pdf file through php, if you know the path and the file name both?
If you have both, you can simply get it as like other files using fopen etc

please guide me

Use directory functions - http://us2.php.net/manual/en/function.readdir.php

<?php 
$dirsource = "D:/files/images"; 
$dirdest = "D:/files/dest"; 

recursive_copy($dirsource, $dirdest); 

function recursive_copy($dirsource, $dirdest) { 
// recursive function to copy  all subdirectories and contents: 
  if(is_dir($dirsource))$dir_handle=opendir($dirsource); 
  $dirname = substr($dirsource,strrpos($dirsource,"/")+1); 

  mkdir($dirdest."/".$dirname, 0750); 
   while($file=readdir($dir_handle)) 
  { 
    if($file!="." && $file!="..") 
    { 
      if(!is_dir($dirsource."/".$file)) copy ($dirsource."/".$file, $dirdest."/".$dirname."/".$file); 
      else 
      { 
          $dirdest1 = $dirdest."/".$dirname; 
       recursive_copy($dirsource."/".$file, $dirdest1); 
      } 
    } 
  } 
  closedir($dir_handle); 
  return true; 
} 
echo "dir copy"; 
die; 

$dirsource = "D:/files/test"; 
$dirdest = "D:/files/test1"; 
recursive_move($dirsource, $dirdest); 

function recursive_move($dirsource, $dirdest) 
{ // recursive function to copy  all subdirectories and contents: 
  if(is_dir($dirsource))$dir_handle=opendir($dirsource); 
  $dirname = substr($dirsource,strrpos($dirsource,"/")+1); 

  mkdir($dirdest."/".$dirname, 0750); 
   while($file=readdir($dir_handle)) 
  { 
    if($file!="." && $file!="..") 
    { 
      if(!is_dir($dirsource."/".$file)) 
      { 
      copy ($dirsource."/".$file, $dirdest."/".$dirname."/".$file); 
      unlink($dirsource."/".$file); 
      } 
      else 
      { 
          $dirdest1 = $dirdest."/".$dirname; 
       recursive_move($dirsource."/".$file, $dirdest1); 
      } 
    } 
  } 
  closedir($dir_handle); 
  rmdir($dirsource); 
} 
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.