public function asDownload($encFileName, $encRealFileName)
    {
        try {
            return Cache::remember($encFileName.'_asDownload', 3600, function () use ($encFileName, $encRealFileName) {
                $fileName = CryptoServiceFacade::url_decode($encFileName);
                $realFileName = CryptoServiceFacade::url_decode($encRealFileName);
                $filePath = $this->getFilePath($fileName);

                $fileTool = new SplFileInfo($filePath);
                $ext = $fileTool->getExtension();
                $contentType = $this->getMimeType($ext);

                $headers = ['Content-Type' => $contentType];
                $fileContent = $this->getFileContent($realFileName, $contentType, $ext);

                return Response::make($fileContent, 200, [
                    'Content-Type' => $contentType,
                    'Content-Disposition' => 'attachment; filename="'.$fileName.'"',
                ]);
            });
        } catch (Exception $e) {
            Cms::notification('We encountered an error with that file', 'danger');

            return redirect('errors/general');
        }
    }
public function asDownload($encFileName, $encRealFileName)
    {
        try {
            return Cache::remember($encFileName.'_asDownload', 3600, function () use ($encFileName, $encRealFileName) {
                $fileName = CryptoServiceFacade::url_decode($encFileName);
                $realFileName = CryptoServiceFacade::url_decode($encRealFileName);
                $filePath = $this->getFilePath($fileName);

                $fileTool = new SplFileInfo($filePath);
                $ext = $fileTool->getExtension();
                $contentType = $this->getMimeType($ext);

                $headers = ['Content-Type' => $contentType];
                $fileContent = $this->getFileContent($realFileName, $contentType, $ext);

                return Response::make($fileContent, 200, [
                    'Content-Type' => $contentType,
                    'Content-Disposition' => 'attachment; filename="'.$fileName.'"',
                ]);
            });
        } catch (Exception $e) {
            Cms::notification('We encountered an error with that file', 'danger');

            return redirect('errors/general');
        }
    }
public function asDownload ( $ encFileName , $ encRealFileName ) { try { return Cache :: remember ( $ encFileName . '_asDownload' , 3600 , function ( ) use ( $ encFileName , $ encRealFileName ) { $ fileName = CryptoServiceFacade :: url_decode ( $ encFileName ) ; $ realFileName = CryptoServiceFacade :: url_decode ( $ encRealFileName ) ; $ filePath = $ this -> getFilePath ( $ fileName ) ; $ fileTool = new SplFileInfo ( $ filePath ) ; $ ext = $ fileTool -> getExtension ( ) ; $ contentType = $ this -> getMimeType ( $ ext ) ; $ headers = [ 'Content-Type' => $ contentType ] ; $ fileContent = $ this -> getFileContent ( $ realFileName , $ contentType , $ ext ) ; return Response :: make ( $ fileContent , 200 , [ 'Content-Type' => $ contentType , 'Content-Disposition' => 'attachment; filename="' . $ fileName . '"' , ] ) ; } ) ; } catch ( Exception $ e ) { Cms :: notification ( 'We encountered an error with that file' , 'danger' ) ; return redirect ( 'errors/general' ) ; } }
Provide file as download.

@param string $encFileName
@param string $encRealFileName

@return Downlaod
Provide file as download .