• 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

Laravel with App Engine Standard Class 'FacadeIgnitionIgnitionServiceProvider' not found

How to install ZeroMQ for PHP on an Alpine Linux container?

Check if my GET request has Header: Token

MySQL order by field in Eloquent

Access relation of pivot table in Laravel

How to to send mail using gmail in Laravel?

Message: Set sys_temp_dir in your php.ini after installed composer

Saving Data from form to database using AngularJS and php

how to youtube api data to print in toolset metabox using a button click before save-post

retrieve data from database using session

How to unlink image from folder?

Using Associative arrays

Input and output values for php into the browser?

error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure

Select option menu read from database and use it's values

About Contact Privacy policy Terms and conditions