• 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

Only on Firefox "Loading failed for the <script> with source"

Target Laravelista is not instantiable

Laravel Database Strict Mode

target [LaravelFortifyContractsRegisterViewResponse] is not instantiable

possible options to create pdf file using html elements to generate invoice in php and codeigniter

Login if user is active using Laravel Breeze

Dynamic dropdown Ajax PHP request

PHP header location absolute URL

Limit WooCommerce products in cart only from one custom taxonomy

MySQL upgrade causing unexpected results on simple WHERE clauses

I want to store data in new index as per my key in php [duplicate]

Laravel Unknown Column 'updated_at'

I cannot create a auto generated date time in mysql workbench

echo language construct is discouraged. (PHP)

xdebug 3 not working in ubuntu 20.04 with docker

About Contact Privacy policy Terms and conditions