When I uploaded a file it will convert to .zip in laravel storage (not corrupted, can still export) but when I uploaded it in our server using sFTP and when I extract the .zip file in the server, It became a corrupted .zip file.
$sftp = new SFTP($this->api_host);
if(!$sftp->login($this->ftp_user, $this->ftp_password)) {
return false;
}
file path to be uploaded
$file = base_path().$this->destinationPathZipped;
creating folder in server
$sftp->mkdir($tempFolder);
change permission of the temp folder
$sftp->chmod(0777, $tempFolder, true);
change directory to folder
$sftp->chdir($sftp->pwd().'/'.$tempFolder.'/');
upload file using sftp $filename = name of zip file (ex: ZCW123.zip)
$s = $sftp->put($filename, $file.$filename);
The code above is how I upload my file using sftp in our server. I am using phpseclib/sftp, the version of my laravel is 5.1
the echo $sftp->getSFTPLog()
after $sftp->put()
is here:
https://i.stack.imgur.com/ORGmF.jpg