Ben Alfresco gelen php bir dosya okuma ve sonra tarayıcıya çıktısı ediyorum. Sadece ptoblem mimetype veya dosya uzantısıdır. Bu ben kullanıyorum kodu:
<?php
ob_start();
//require_once("libs/FirePHPCore/fb.php");
require_once("libs/AlfrescoConnect.php");
$nomeFile = rawurldecode($_GET['nomeFile']);
$urlDownload = $_GET['urlDownload'];
$fileDownloadUrl = AlfrescoConnect::$serverPath. $urlDownload . "&attach=true&alf_ticket=".AlfrescoConnect::getTiket();
fb($fileDownloadUrl);
$cnt = file_get_contents($fileDownloadUrl);
header("Content-type: Application/octet-stream");
header('Cache-Control: must-revalidate');
header('Content-disposition: attachment; filename=' .$nomeFile);
echo($cnt);
exit();
echo("Impossibile trovare il file");
I receive the name of the file from the get becausa i don't know how to get the name from alfresco, but i have to guess the mimetype somehow. if i "echo" $cnt in the firsat caracters there are references to the fact that it is a PDF (for example on screen i see "%PDF-1.3 %âãÏÓ 2 0 obj << /Length 3 0 R /Filter /CCITTFaxDecode /DecodeParms << /K 0 /Columns 2480 /Rows 3508 >> /Type /XObject /Subtype /Image /Width 2480 /Height 3508 /BitsPerComponent 1 /ColorSpace /DeviceGray >> stream" so there must be a way to get the mime_tipe from it with a function.
Herhangi bir yardım apprecieted olduğunu!
Edit. If anyone is intereste here is a class that you can use to get the extension from the mime-type. http://www.ustrem.org/en/articles/mime-type-by-extension-en/