diff options
author | Alexander Tkachev | 2016-07-10 10:29:51 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | 3064b44b92e8d0aff3a7d5b4b721d635ead7c5e9 (patch) | |
tree | 7204ec1c9debb966f44c17b248b535d91f3b5cc1 /backends | |
parent | 12518ed0bf60689e69c9f569bf90d5466cdc0551 (diff) | |
download | scummvm-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')
-rw-r--r-- | backends/networking/sdl_net/uploadfileclienthandler.cpp | 29 | ||||
-rw-r--r-- | backends/networking/wwwroot.zip | bin | 230989 -> 231000 bytes | |||
-rw-r--r-- | backends/networking/wwwroot/.files.html | 2 |
3 files changed, 17 insertions, 14 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 diff --git a/backends/networking/wwwroot.zip b/backends/networking/wwwroot.zip Binary files differindex 4dcb9b0dfd..ae19ef7d29 100644 --- a/backends/networking/wwwroot.zip +++ b/backends/networking/wwwroot.zip diff --git a/backends/networking/wwwroot/.files.html b/backends/networking/wwwroot/.files.html index d14acfcd36..c83a59f718 100644 --- a/backends/networking/wwwroot/.files.html +++ b/backends/networking/wwwroot/.files.html @@ -26,7 +26,7 @@ <div id="upload_file" class="modal"> <p>{upload_file_desc}</p> <form action="upload?path={path}" method="post" enctype="multipart/form-data"> - <input type="file" name="upload_file"/> + <input type="file" name="upload_file[]" multiple/> <input type="submit" value="{upload_file_button}"/> </form> </div> |