Welcome Guest, Not a member yet? Register   Sign In
Zip files from URL
#1

Hi;

How can I zip a few files from url?

This doesn't seem to be the right approach:

PHP Code:
$data = array(
'https://s3.amazonaws.com/files/templates/ai/Tactify+Card+Template+NFC+-+QR.ai' => 'NFC-QR-ai',
'https://s3.amazonaws.com/files/templates/ai/Tactify+Card+Template+NFC.ai' => 'NGF-ai');

$this->zip->add_data($data);
$this->zip->download('templates.zip'); 
Reply
#2

Anyone?

Is there something wrong with CI's zip library?

I read in a few posts that this is broken Sad
Reply
#3

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()

http://www.codeigniter.com/userguide3/li...s/zip.html
Reply




Theme © iAndrew 2016 - Forum software by © MyBB