aboutsummaryrefslogtreecommitdiff
path: root/backends/networking/sdl_net
diff options
context:
space:
mode:
authorAlexander Tkachev2016-07-10 10:29:51 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commit3064b44b92e8d0aff3a7d5b4b721d635ead7c5e9 (patch)
tree7204ec1c9debb966f44c17b248b535d91f3b5cc1 /backends/networking/sdl_net
parent12518ed0bf60689e69c9f569bf90d5466cdc0551 (diff)
downloadscummvm-rg350-3064b44b92e8d0aff3a7d5b4b721d635ead7c5e9.tar.gz
scummvm-rg350-3064b44b92e8d0aff3a7d5b4b721d635ead7c5e9.tar.bz2
scummvm-rg350-3064b44b92e8d0aff3a7d5b4b721d635ead7c5e9.zip
CLOUD: Switch to "multiple" files uploading
Still doesn't support directories uploading.
Diffstat (limited to 'backends/networking/sdl_net')
-rw-r--r--backends/networking/sdl_net/uploadfileclienthandler.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/backends/networking/sdl_net/uploadfileclienthandler.cpp b/backends/networking/sdl_net/uploadfileclienthandler.cpp
index 733a87b102..0ca5e3f684 100644
--- a/backends/networking/sdl_net/uploadfileclienthandler.cpp
+++ b/backends/networking/sdl_net/uploadfileclienthandler.cpp
@@ -114,7 +114,7 @@ void UploadFileClientHandler::handleBlockHeaders(Client *client) {
Common::String headers = readEverythingFromMemoryStream(_headersStream);
Common::String fieldName = "";
readFromThatUntilDoubleQuote(headers.c_str(), "name=\"", fieldName);
- if (fieldName != "upload_file") return;
+ if (!fieldName.hasPrefix("upload_file[")) return;
Common::String filename = "";
readFromThatUntilDoubleQuote(headers.c_str(), "filename=\"", filename);
@@ -148,18 +148,21 @@ void UploadFileClientHandler::handleBlockContent(Client *client) {
// if previous block headers were file-related and created a stream
if (_contentStream) {
_contentStream->flush();
- // success - redirect back to directory listing
- HandlerUtils::setMessageHandler(*client,
- Common::String::format(
- "%s<br/><a href=\"files?path=%s\">%s</a>",
- _("Uploaded successfully!"),
- client->queryParameter("path").c_str(),
- _("Back to parent directory")
- ),
- "/files?path=" + LocalWebserver::urlEncodeQueryParameterValue(client->queryParameter("path"))
- );
- _state = UFH_STOP;
- return;
+
+ if (client->noMoreContent()) {
+ // success - redirect back to directory listing
+ HandlerUtils::setMessageHandler(*client,
+ Common::String::format(
+ "%s<br/><a href=\"files?path=%s\">%s</a>",
+ _("Uploaded successfully!"),
+ client->queryParameter("path").c_str(),
+ _("Back to parent directory")
+ ),
+ "/files?path=" + LocalWebserver::urlEncodeQueryParameterValue(client->queryParameter("path"))
+ );
+ _state = UFH_STOP;
+ return;
+ }
}
// if no file field was found, but no more content avaiable - failure