File browser upload problem

Hi, I have a CMS and when I want to upload a file in the backend, as usual on most systems, I click browse then select the required file and click open, then upload, and that’s it. My problem is that when I click browse, the newly opened upload browser will only show files with a PHP extension and I want it to also show PDF extensions.

I believe this is the php code responsible for the browse window:
[php]

<?PHP require 'check-login.php' ; require '../cmsfns.php' ; /* Params: $_GET['dir'] - The directory we're currently browsing $_GET['type'] - Limit the file extensions to show (currently only supports one, only 'php' used) */ if (isset($_GET['dir'])) { // Strip off trailing slash if one exists define ("DIR", rtrim($_GET['dir'],'/')) ; } else { define ("DIR", '..') ; } ?> Browse content - <?PHP echo stripslashes($_SESSION['CMS_Title']) ; ?> body {padding:1em;} h1 { font-size:1.5em; }

Select page/file:

<?PHP // Break down current location, linking to each folder.. $folders = explode('/',DIR) ; $levels = sizeof($folders) ; $link = '' ; for ($fldr=0; $fldr<$levels; $fldr++) { $link .= $folders[$fldr] ; $link .= '/' ; if ($fldr < $levels-1) { echo '' ; } if ($folders[$fldr] == "..") $folders[$fldr] = "Home" ; echo ' ' . $folders[$fldr] ; if ($fldr < $levels-1) { echo '' ; } echo ' /' ; } ?>
<?PHP $handle = opendir(DIR) ; $itemsFound = 0 ; $outputHTML = '' ; $outputDirs = '' ; $outputFiles = '' ; while (false !== ($file = readdir($handle))) { $previewFile = getPreviewFileFromLive(DIR.'/'.$file) ; if (strstr($file, 'phpthumb') || strstr($file, 'phpthumb') || !file_exists($previewFile)) { continue ; } if ( (!in_array($file, $reserved_filenames) && !in_array('../'.$file, $reserved_filenames) ) || ($file == 'cmsfiles') ) { $itemsFound++ ; if (is_dir(DIR.'/'.$file)) { // Directory $outputDirs .= "\n
  • " ; $outputDirs .= '' ; $outputDirs .= $file ; $outputDirs .= '
  • ' ; } else if (isSet($_GET['type'])) { if ($_GET['type'] == 'php' && getFileExtension($file) == 'php') { // Page link $outputFiles .= "\n" . '
  • ' ; $outputFiles .= $file ; $outputFiles .= '' ; $outputFiles .= "\n
  • " ; } else if ($_GET['type'] == getFileExtension($file) ) { // Other matching file $outputFiles .= "\n" . '
  • ' ; $outputFiles .= $file ; $outputFiles .= '' ; $outputFiles .= "\n
  • " ; } } else { // Unspecified (i.e. 'File' type link) $outputFiles .= "\n" . '
  • ' ; $outputFiles .= $file ; $outputFiles .= '' ; $outputFiles .= "\n
  • " ; } } } closedir($handle) ; if ($itemsFound > 0) { $outputHTML = '
      ' . $outputDirs . $outputFiles . '
    ' ; } else { $outputHTML .= '
    No files or folders found
    ' ; } echo $outputHTML ; ?> [/php]

    And I also believe this is snippet that only allows php files to be shown in the upload browser:
    [php]
    else if (isSet($_GET[‘type’])) {
    if ($_GET[‘type’] == ‘php’ && getFileExtension($file) == ‘php’) {
    // Page link
    $outputFiles .= “\n” . ‘

  • ’ ;
    $outputFiles .= $file ;
    $outputFiles .= ‘
    ’ ;
    $outputFiles .= “\n
  • ” ;
    }

    [/php]

    ok ya it is try this

    [php]
    else if (isSet($_GET[‘type’])) {
    if ($_GET[‘type’] == ‘pdf’ && getFileExtension($file) == ‘pdf’) {
    // Page link
    $outputFiles .= “\n” . ‘

  • ’ ;
    $outputFiles .= $file ;
    $outputFiles .= ‘
    ’ ;
    $outputFiles .= “\n
  • ” ;
    }
    [/php]
    Sponsor our Newsletter | Privacy Policy | Terms of Service