This commit is contained in:
an-tao 2021-11-29 00:28:04 +08:00
parent ee562343c1
commit 4c151e610c
1 changed files with 2 additions and 1 deletions

View File

@ -84,7 +84,8 @@ int HttpFileImpl::saveTo(const filesystem::path &pathAndFileName) const
{ {
LOG_TRACE << "save uploaded file:" << pathAndFileName; LOG_TRACE << "save uploaded file:" << pathAndFileName;
auto wPath = utils::toNativePath(pathAndFileName.native()); 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()) if (file.is_open())
{ {
file.write(fileContent_.data(), fileContent_.size()); file.write(fileContent_.data(), fileContent_.size());