CodeIgniter Forums

Full Version: Zip files from URL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

How can I zip a few files from url?

This doesn't seem to be the right approach:

PHP Code:
$data = array(
'' => 'NFC-QR-ai',
'' => 'NGF-ai');


Is there something wrong with CI's zip library?

I read in a few posts that this is broken Sad
I think you have misunderstood how the add_data function works when using an array. You are trying to use the file key as path, which is incorrect.
  1. The parameters are ordered as file => contents, first parameters being the file name you want to have in the zip file, and the second parameter being the content to put into that file.

  2. For the content, the add_data function do not support reading a file. You either have to use the read_file function or read the file yourself by using file_get_contents()

  3. As far as I'm aware, the zip library do not support reading external urls. The paths has to be to a file on your server. If your server support reading external urls, you should be able to use file_get_contents()