• 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

What is the function of the (new Date()).getTime() in PHP?

dompdf and img tag, image wont show

Changing font color in javascript

Php - Sum up the numbers in an array one by one

How to add a custom field to all Woocommerce attribute terms using add_action

Apply filter array/return terms

Laravel unique validation on multiple columns

unable to load your default controller on Codeigniter

Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::fetch_assoc() [duplicate]

correct PHP headers for pdf file download

How to solve Duplicate entry '0' for key 'PRIMARY' in Wordpress?

I want a way to give path to my files which are outside of public folder in laravel

PHP | "The requested PHP extension bcmath is missing from your system."

How can i update or reset my password without entering email field in laravel-8?

Sort multidimensional array by column value within a column

About Contact Privacy policy Terms and conditions