Yii Framework Forum: Downloading file from ftp server fails - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Downloading file from ftp server fails [canceled]

#1 User is offline   tklustig 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 305
  • Joined: 20-April 17
  • Location:Hannover

Posted 11 January 2018 - 03:54 PM

hi guys, following code will download files from my ftp server without any problems:

$sourceDirectory = $folder_ftp;
$targetDirectory = Yii::getAlias('@uploading');
$ftp->getAll($sourceDirectory, $targetDirectory);


Following code fails by throwing out error
ftp_get(/FTP_Server/Diverses/12_Joinabfragen.docx): failed to open stream: No such file or directory


Courisly it's same file, which will be transfered using upper example. So, i am 100% sure,that file is at my server
Any ideas, why following code will throw out error?

 	$sourceDirectory = $folder_ftp;
            $targetDirectory = Yii::getAlias('@uploading');
            for ($i = 0; $i < count($anhang); $i++) {
            		$ftp->get($sourceDirectory.$anhang[$i], $targetDirectory , FTP_BINARY);
            }

0

#2 User is offline   tklustig 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 305
  • Joined: 20-April 17
  • Location:Hannover

Posted 11 January 2018 - 04:03 PM

Got it by my own.
Following code will fix this error:

        $sourceDirectory = $folder_ftp;
        $targetDirectory = Yii::getAlias('@uploading');
            for ($i = 0; $i < count($anhang); $i++) {
                $fetchFile = $ftp->get($targetDirectory.$anhang[$i], $sourceDirectory.$anhang[$i] , FTP_BINARY);
            }


So,this thread can be closed as succefully solved
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users