Add append/overwrite parameter to Ftp::upload.

This commit is contained in:
irrmich 2016-03-18 16:12:03 +01:00 committed by Lukas Dürrenberger
parent 7be2111d61
commit 15d0f789c7
2 changed files with 7 additions and 3 deletions

View file

@ -322,7 +322,7 @@ Ftp::Response Ftp::download(const std::string& remoteFile, const std::string& lo
////////////////////////////////////////////////////////////
Ftp::Response Ftp::upload(const std::string& localFile, const std::string& remotePath, TransferMode mode)
Ftp::Response Ftp::upload(const std::string& localFile, const std::string& remotePath, TransferMode mode, bool append)
{
// Get the contents of the file to send
std::ifstream file(localFile.c_str(), std::ios_base::binary);
@ -346,7 +346,7 @@ Ftp::Response Ftp::upload(const std::string& localFile, const std::string& remot
if (response.isOk())
{
// Tell the server to start the transfer
response = sendCommand("STOR", path + filename);
response = sendCommand(append ? "APPE" : "STOR", path + filename);
if (response.isOk())
{
// Send the file data