CC-5892: Handle when a file is downloaded from the Airtime library

This commit is contained in:
drigato 2014-07-10 17:59:27 -04:00
parent 6f119b006f
commit e7dfc08128
2 changed files with 13 additions and 1 deletions

View File

@ -81,6 +81,18 @@ class ApiController extends Zend_Controller_Action
$media = Application_Model_StoredFile::RecallById($fileId);
if ($media != null) {
if ($media->isInCloud()) {
if ("true" == $this->_getParam('download')) {
header('Content-type:'.$media->getPropelOrm()->getDbMime());
header('Content-Disposition: attachment; filename="'.$media->getResourceId().'"');
header('Content-length:'.$media->getFileSize());
echo $media->getCloudUrl();
exit;
} else {
$this->_redirect($media->getCloudUrl());
}
}
$filepath = $media->getFilePath();
// Make sure we don't have some wrong result beecause of caching

View File

@ -46,8 +46,8 @@ class AudiopreviewController extends Zend_Controller_Action
}
if ($type == "audioclip") {
$uri = $baseUrl."api/get-media/file/".$audioFileID;
$media = Application_Model_StoredFile::RecallById($audioFileID);
$uri = $baseUrl."api/get-media/file/".$audioFileID;
$mime = $media->getPropelOrm()->getDbMime();
} elseif ($type == "stream") {
$webstream = CcWebstreamQuery::create()->findPk($audioFileID);