I'm building a website for my band. However, as I don't want to be the only one maintaining the site, I want to allow the other members to contribute via a dropbox-folder.
I have received a direct download link from dropbox that zip's the whole folder. this links looks something like this: http://www.dropbox.com/sh/xxxxxxxxxxxxxxx/yyyyyyyyyyyyyyyyyyyyyyyyy?dl=1
A folder test with 777 rights is available on the server side.
However the dropbox zip-file won't extract, and windows-created zip-file does.
<?php
echo PHP_OS.' PHP:'.phpversion();
echo '<br>starting download<br>';
$dbLink = 'http://www.dropbox.com/sh/xxxxxxxxxxxxxxx/yyyyyyyyyyyyyyyyyyyyyyyyy?dl=1'
$success = file_put_contents("./test.zip", fopen($dbLink, 'r'));
if ($success === FALSE) {
echo 'error storing zip';
} else {
echo 'success storing zip';
}
echo '<br>';
$zip = new ZipArchive;
$result = $zip->open('./test.zip');
if ($result === TRUE) {
echo 'opened zip<br>';
$success = $zip->extractTo('./test/');
if ($success === TRUE) {
echo 'unzip complete';
} else {
echo 'unzip failed';
}
$zip->close();
} else {
echo 'unable to open zip';
}
?>
I'd like to hear your thought on this.