Search

Dec 16, 2015

Action download file in PHP


/**
 * Action Download file
 * @return undefined
 */
public function actionDownload()
{
    $file = Yii::app()->request->getParam('file');
    $modelArchives = Archives::model()->find('path=:path', array(':path' => $file));
    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Content-type:application/octet-stream");
    header('Content-Disposition: attachment; filename="' . $modelArchives->fileName . '"');
    $contentArchive = Yii::getPathOfAlias('webroot') . Yii::app()->params["archiveFolderPath"] . '/' . $file;
    echo file_get_contents($contentArchive);
    exit;
}

Dec 9, 2015

CSS trick: Sort String and add 3 dot at last point of string


.sortTitle {
    width: calc(100% - 20px);
    display: inline;
    text-overflow: ellipsis;   
    white-space: nowrap; 
    overflow: hidden;
}