• 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

WHM Enabling mod_rewrite

Cannot retrieve error message using Symfony HttpClient if the response is not "ok"

target [LaravelFortifyContractsRegisterViewResponse] is not instantiable

Loading data from MySQL and populating dropdown select with jQuery Mobile, PHP

PHP: Insert marker every 3 iterations

PHP date() with timezone?

Create tags in laravel post publishing

Sum array values of a column within each column of an array with 3 levels

PHP Get value from JSON [duplicate]

Elastic Beanstalk with Laravel Envoy

How can I get a div content in php

laravel sanctum Route [login] not defined

Detect emoticons in string

Clients authentication and user authentication with laravel

Remove product downloads section in woocommerce email notifications

About Contact Privacy policy Terms and conditions