0

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?

Votes + Comments
Good question.
3
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by __avd
0

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

0

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

0

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); 
} 
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.