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());