コード例 #1
0
ファイル: fileViewer.php プロジェクト: PseudoAj/mfcs
     // Combined file
     if ($fileType == 'combinedPDF') {
         // Show the combined PDF
         // Find the file that has an application mime type (like a PDF)
         foreach ($fileArray['files']['combine'] as $file) {
             if (FALSE !== strpos($file['type'], 'application/')) {
                 $filepath = files::getSaveDir($fileUUID, 'combine') . $file['name'];
                 break;
             }
         }
     } else {
         // Show the combined PDF's thumbnail
         // Find the file that has an image mime type
         foreach ($fileArray['files']['combine'] as $file) {
             if (FALSE !== strpos($file['type'], 'image/')) {
                 $filepath = files::getSaveDir($fileUUID, 'combine') . $file['name'];
                 break;
             }
         }
     }
 }
 // Make sure the file exists
 if (!file_exists($filepath)) {
     throw new Exception('File not found! "' . $filepath . '"');
 }
 // Get the MIME Type
 if (isPHP('5.3')) {
     $fi = new finfo(FILEINFO_MIME_TYPE);
     $mimeType = $fi->file($filepath);
 } else {
     $fi = new finfo(FILEINFO_MIME);