• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Zip files from URL


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');



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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.