I am trying to create a zip file from local files and stream it directly to an ftp (without writing the zip to disk first). I have no problems with zipping itself but it seems like the ZipArchive class doesn't recognize the ftp stream wrapper.
The following code is the simplest thing I could come up with that will illustrate the problem
<?php
$zip = new ZipArchive();
var_dump($zip->open('ftp://[username]:[password]@[hostname.net]/public_html/test.zip', ZipArchive::OVERWRITE));
$zip->addFile(realpath('/input.txt'), 'input.txt');
var_dump($zip->close());
The $zip->open
call returns true
while $zip->close
returns false
. I can't find a way to get an error message or something that can be more specific than just there is an error
. The question is what am I doing wrong, or I can't do these kind of stuff with the ZipArchive class.