efilecloaker Cloak your files link from end users.

  1. Requirements
  2. Usage

This extension is a simple implementation to cloak your original location of files to be downloaded. That way, no direct links to your file will be available to visitors.

Requirements

  • Yii 1.1.6 or above
  • mod_xsendfile (optional) to allow download of large files with ease

Usage

How to use:

  • Download and extract EFileCloaker in your extension directory.
  • Modify your configuration file to auto import the extension folder example:
<?php
    'import'=>array(
         'application.extensions.*',
    ),
?>
  • Call the widget with parameters: (1) OriginalFileName as displayed name; (2) OriginalUrl as direct link to file. Example:
<?php
       $this->widget('application.extensions.EFileCloaker', array(
           'OriginalFileName'=>'Demo File',
           'OriginalUrl'=>'../../file/demofile.pdf',
       ));
?>
  • Create an action to download files. Example:
<?php
	public function actionDownload()
	{
		$uncloak = new EFileCloaker();
		
		// To get original Url for further processing
		// $originalUrl = $uncloak->getOriginalUrl();
		
		// Downloads the file indicated by the $_GET key
		$uncloak->download();
		
		// Or downloads the file while specifiying
		// some actions before actual downloads happens
		// with a callback function
		// $uncloak->download(function($key, $originalUrl) { 
		// 	die($key . $originalUrl); 
		// });
	}
?>
  • Done
4 2
3 followers
1 094 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: File System
Developed by: Blue Spy
Created on: Oct 26, 2011
Last updated: 12 years ago

Downloads

show all