Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specify filename in UploadFileToControllerViaForm #107

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/controllerclientimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ void ControllerClientImpl::_UploadFileToController_UTF8(const std::string& filen
}

MUJIN_LOG_DEBUG(str(boost::format("upload %s")%uri))
_UploadFileToControllerViaForm(fin, filenameoncontroller, _baseuri + "fileupload");
_UploadFileToControllerViaForm(fin, filenameoncontroller, _baseuri + "fileupload?filename=" + filenameoncontroller);
ziyan marked this conversation as resolved.
Show resolved Hide resolved
}

void ControllerClientImpl::_UploadFileToController_UTF16(const std::wstring& filename, const std::string& uri)
Expand All @@ -1694,7 +1694,7 @@ void ControllerClientImpl::_UploadFileToController_UTF16(const std::wstring& fil
}

MUJIN_LOG_DEBUG(str(boost::format("upload %s")%uri))
_UploadFileToControllerViaForm(fin, filenameoncontroller, _baseuri + "fileupload");
_UploadFileToControllerViaForm(fin, filenameoncontroller, _baseuri + "fileupload?filename=" + filenameoncontroller);
}

void ControllerClientImpl::_UploadFileToController(FILE* fd, const std::string& uri)
Expand Down Expand Up @@ -1840,10 +1840,10 @@ void ControllerClientImpl::_UploadDataToController(const std::vector<unsigned ch
// 204 is when it overwrites the file?
if( http_code != 201 && http_code != 204 ) {
if( http_code == 400 ) {
throw MUJIN_EXCEPTION_FORMAT("upload of to failed with HTTP status %s, perhaps file exists already?", desturi%http_code, MEC_HTTPServer);
throw MUJIN_EXCEPTION_FORMAT("upload of %s to failed with HTTP status %s, perhaps file exists already?", desturi%http_code, MEC_HTTPServer);
}
else {
throw MUJIN_EXCEPTION_FORMAT("upload of to failed with HTTP status %s", desturi%http_code, MEC_HTTPServer);
throw MUJIN_EXCEPTION_FORMAT("upload of %s to failed with HTTP status %s", desturi%http_code, MEC_HTTPServer);
}
}
}
Expand Down