From 4c151e610cb9e0b1d8ff6023313f9617ee3444a7 Mon Sep 17 00:00:00 2001 From: an-tao Date: Mon, 29 Nov 2021 00:28:04 +0800 Subject: [PATCH] flag --- lib/src/HttpFileImpl.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/src/HttpFileImpl.cc b/lib/src/HttpFileImpl.cc index be69e231..2894f62f 100644 --- a/lib/src/HttpFileImpl.cc +++ b/lib/src/HttpFileImpl.cc @@ -84,7 +84,8 @@ int HttpFileImpl::saveTo(const filesystem::path &pathAndFileName) const { LOG_TRACE << "save uploaded file:" << pathAndFileName; auto wPath = utils::toNativePath(pathAndFileName.native()); - std::ofstream file(wPath, std::ios::binary); + std::ofstream file(wPath, + std::ios::binary | std::ios::out | std::ios::trunc); if (file.is_open()) { file.write(fileContent_.data(), fileContent_.size());