Yii Framework Forum: Widget for FTP needed! - Yii Framework Forum

Jump to content

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

Widget for FTP needed! [solved]

#1 User is offline   tklustig 

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

Posted 12 February 2018 - 05:35 PM

Hi guys, I use following widget organizing my ftp uploading, downloading and deleting
 "yii2mod/yii2-ftp": "*",

This wdget is a desaster, 'cause it will upload faulty files to server. It's just uploading a small part(in Bytes) of file,This phenomenon just will occur, if file is Winword or PDF. All other files will be uploaded correctly. So, I know, my code is correct. Here is var_dump() of a file, which actually has been uploaded faulty:

$putFile = $connection->put($SourceDirectory . $localFile, $LocalDirectory . $localFile, $mode);
var_dump($putFile);
var_dump($SourceDirectory.$localFile);
E:\xampp\htdocs\yii2_perswitch\common\wsl_components\FTPZugang.php:89:boolean true
E:\xampp\htdocs\yii2_perswitch\common\wsl_components\FTPZugang.php:90:string '/FTP_Server/Diverses/12_Joinabfragen.docx' (length=41)


Following rules are defined in PHP.INI
post_max_size=8M
upload_max_filesize=10M
max_file_uploads=20
;opcache.max_file_size=0


So, my question is: Could somebody recommend me a widget,which will upload( and download) all kind of files without any errors? Please, just recommend me a ftp-widget, If ur experiences with it are postiive!

Here is code of defining $mode for upper put();
public function DateienHochloaden($render, $connection, $localFile, $LocalDirectory) {
$session = new Session();
$docx = '/docx/';
$txt = '/txt/';
$pdf = '/pdf/';
$xlsx = '/xlsx/';
$pptx = '/pptx/';
$basis = $this->GetZugangsDaten($render);
$SourceDirectory = $basis[3];
if (preg_match($docx, $localFile) || preg_match($txt, $localFile) || preg_match($pdf, $localFile) || preg_match($xlsx, $localFile) || preg_match($pptx, $localFile))
    $mode = FTP_ASCII;
else
    $mode = FTP_BINARY;
.
.
.

0

#2 User is offline   tklustig 

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

Posted 12 February 2018 - 05:55 PM

Got it by my own. File was faulty, 'cause I used wrong mode. FTP_BINARY is the right one!
So, not widget but me was the desasterPosted Image

This thread can be closed as succesfully 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