tm1000/freepbx-endpointmanager — Issue #26: Fix this function
Author: tm1000
Created: 2012-01-15 05:07:05+00:00
State: open

If placing the file fails then check permission on the directory in question

`function download_file($url_file, $destination_file) {
$contents = file_get_contents($url_file);
if (preg_match('/200/', $http_response_header[0])) {
$dirname = dirname($destination_file);
if (!file_exists($dirname)) {
mkdir($dirname);
}
file_put_contents($destination_file, $contents);
//check file placement
if (!file_exists($destination_file)) {
return false;
}
return true;
} else {
return false;
}
}`