mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Fix #414 Unable to download file to nonexistent directory
This commit is contained in:
parent
5ed55ff4af
commit
9b5ee1af48
1 changed files with 6 additions and 0 deletions
|
|
@ -423,6 +423,12 @@ class FileHandler
|
|||
*/
|
||||
public static function getRemoteFile($url, $target_filename, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array(), $request_config = array())
|
||||
{
|
||||
$target_dirname = dirname($target_filename);
|
||||
if (!Rhymix\Framework\Storage::isDirectory($target_dirname) && !Rhymix\Framework\Storage::createDirectory($target_dirname))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$request_config['filename'] = $target_filename;
|
||||
$success = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers, $cookies, $post_data, $request_config);
|
||||
return $success ? true : false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue