CodeIgniter Forums
Help with Zip Encoding - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Help with Zip Encoding (/showthread.php?tid=61211)



Help with Zip Encoding - El Forum - 10-16-2014

[eluser]Unknown[/eluser]
Hi all

I am trying to use the read_dir function to no avail, it doesn't seem to matter what I do I can not get this to work.

Can someone take a look and let me know if it is something I am doing wrong (the whole thing seems pretty straight forward) or if this is a known issue and someone has a work around?

My code is as follows:

Code:
class Zipdownloader extends CI_Controller {

public function __construct()
{
  parent::__construct();
  $this->load->library('zip');
}
function index()
{
  $path = 'files/test/';

$this->zip->read_dir($path, FALSE);

// Download the file to your desktop. Name it "backup.zip"
$this->zip->download('backup.zip');
}
}

When I load the page I get nothing, just a blank page, no error or download, just nothing.

I have managed to get add_data working with no issues however this just won't play with me.

Your help is greatly appreciated I am very very new to CodeIgniter and have not worked with PHP in years, and am on a very tight deadline to get this working for my work.


Help with Zip Encoding - El Forum - 10-16-2014

[eluser]rufnex[/eluser]
You should use the download helper:
https://ellislab.com/codeigniter/user-guide/helpers/download_helper.html


Help with Zip Encoding - El Forum - 10-17-2014

[eluser]InsiteFX[/eluser]
Try:

Code:
$path = base_url('files/test/');
// or
$path = site_url('files/test/');