• 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

PHP code for generating decent-looking coupon codes (mix of letters and numbers)

Return multiple values from a function using mysqli_fetch_assoc [closed]

How to convert a carbon into string, to take the date only?

google content api for shopping

how to insert data into select2 search input after scan using qrcode

Changing font color in javascript

Laravel SQL query midnight time not showing

Sliders in Laravel

Laravel UUID generation

api response laravel doesn't show

How to pass data to all views in Laravel 5?

Match single unknown parameter php (Morse-code Regex)

CodeIgniter 4: Like and Dislike Functionality

Display the WooCommerce product price inside a custom function

PHP: Telegram Bot: Insert line break to text message

About Contact Privacy policy Terms and conditions