• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

CodeIgniter force_download is not working

phpcodeigniterforce-download


PHP Snippet 1:

if(!empty($articlefile)){
if(file_exists('./media/journals/xml/'.$articlefile)){
$this->load->helper('download');
//$articlefile = str_replace(" ", "%20", $articlefile); 
//$path=file_get_contents(getBaseUrl().'media/journals/xml/'.$articlefile);
//force_download($articlefile,$path);

$data = 'Here is some text!';
$name = 'mytext.txt';
force_download($name, $data);
}
else{
redirect(getBaseUrl());
exit();
}
}

Related Snippets

RuntimeException: Unable to create the cache directory (/var/www/sonata/app/cache/dev)

Applying programmatically a coupon to an Order in WooCommerce3

How to fix Call to undefined method AppModelsTableName::factory?

How to set a domain name with php artisan serve

Laravel Command Schedule Not Working Properly

PHP: How to solve ob_start() in combination imagepng() issue?

How to show selected value using javascript in laravel

Convert string to lowercase AND then convert it to its original form in PHP, is it possible?

Symfony run hint kernel.secret parameter not found

What is my SQL missing?

Combine array with same value and add other [duplicate]

display WooCommerce “Add to cart” button with short-code [add_to_cart ] dynamically

Losing session data after POST from third party website

Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables 11 [closed]

Insert And Retrieve Data in MySQL with $.post Noob Question

About Contact Privacy policy Terms and conditions