Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to create dir ? ftp_chdir(): Failed to change directory. #6

Closed
fbens opened this issue Aug 2, 2015 · 2 comments
Closed

how to create dir ? ftp_chdir(): Failed to change directory. #6

fbens opened this issue Aug 2, 2015 · 2 comments
Assignees

Comments

@fbens
Copy link
Contributor

fbens commented Aug 2, 2015

how to create a unknow dir?

$dir = date('Y/ym/d')

i don't know either this dir is exist or not

//$dir = 'img/'.date('Y/ym/d');
$dir = 'img/2015/1508/02';
        $arr = explode($split, $dir);
        foreach($arr as $d){

            if(!\Yii::$app->ftp->chdir($d)){
                \Yii::$app->ftp->mkdir($d);    
            }
        }

throw error ftp_chdir(): Failed to change directory.

@hguenot
Copy link
Owner

hguenot commented Aug 3, 2015

You have to catch gftp\FtpException.
I will add method fileExists in driver in order to test file existence.

@hguenot
Copy link
Owner

hguenot commented Aug 3, 2015

Method fileExists added in FtpComponent and drivers.
Cf. commit : fc81a9d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants