From 991f8c688753e294554a7eaf7ac8eeb0eb8e4ea5 Mon Sep 17 00:00:00 2001 From: norbim1 Date: Thu, 29 Oct 2020 11:40:41 +0100 Subject: Correct client upload in blocking mode Client upload with TransferType=FTP_PUT cleared the local file content. It first opened the file in write mode, because (direction & FTP_GET) gives TRUE in this case also. As a result blocking mode always uploaded a 0 length file and cleared the local file. --- FTPClient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FTPClient.cpp b/FTPClient.cpp index 51456f9..4ea31be 100644 --- a/FTPClient.cpp +++ b/FTPClient.cpp @@ -19,9 +19,9 @@ const FTPClient::Status &FTPClient::transfer(const String &localFileName, const _remoteFileName = remoteFileName; _direction = direction; - if (direction & FTP_GET) + if (direction & FTP_GET_NONBLOCKING) file = THEFS.open(localFileName, "w"); - else if (direction & FTP_PUT) + else if (direction & FTP_PUT_NONBLOCKING) file = THEFS.open(localFileName, "r"); if (!file) -- cgit v1.2.3