Set the uploaded file path to site/temp by default. Can be set via configuration with "temp-dir" variable.

(This is important, otherwise it uses the current working directory, but for fcgi, this is not always obvious where it is.)
Allow advanced upload, and also basic html upload, in case the dropzone.js has trouble.
Split get and post handling for files module upload request.
This commit is contained in:
2016-09-26 10:37:41 +02:00
parent b1478cfb8a
commit 0c3b85bb37
4 changed files with 95 additions and 29 deletions

View File

@@ -2,8 +2,8 @@ note
description: "[
Class that enable to set basic configuration, application environment, core modules and themes.
]"
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
revision: "$Revision: 96616 $"
date: "$Date$"
revision: "$Revision$"
deferred class
CMS_SETUP
@@ -70,6 +70,13 @@ feature {NONE} -- Initialization
files_location := site_location.extended ("files")
end
-- Location for temp files
if attached text_item ("temp-dir") as l_temp_dir then
create temp_location.make_from_string (l_temp_dir)
else
temp_location := site_location.extended ("temp")
end
-- Location for modules folders.
if attached text_item ("modules-dir") as l_modules_dir then
create modules_location.make_from_string (l_modules_dir)
@@ -314,6 +321,10 @@ feature -- Access: Theme
site_location: PATH
-- Path to CMS site root dir.
temp_location: PATH
-- Path to folder used as temporary dir.
-- (Mainly for uploaded file).
files_location: PATH
-- Path to public "files" dir.

View File

@@ -1,7 +1,7 @@
note
description: "API for a CMS"
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
revision: "$Revision: 96616 $"
date: "$Date$"
revision: "$Revision$"
class
CMS_API
@@ -628,6 +628,12 @@ feature -- Environment/ theme
Result := setup.site_location
end
temp_location: PATH
-- CMS temp folder location.
do
Result := setup.temp_location
end
files_location: PATH
-- CMS public files location.
do

View File

@@ -14,6 +14,7 @@ inherit
undefine
requires_proxy
redefine
execute,
create_router, router,
execute_default,
filter_execute,
@@ -26,6 +27,8 @@ inherit
WSF_ROUTED_URI_TEMPLATE_HELPER
WSF_REQUEST_EXPORTER
REFACTORING_HELPER
SHARED_LOGGER
@@ -193,7 +196,20 @@ feature -- Settings: router
a_router.handle ("/", fhdl, router.methods_GET)
end
feature -- Execute Filter
feature -- Request execution
initialize_execution
-- Initialize CMS execution.
do
request.set_uploaded_file_path (api.temp_location)
end
execute
-- <Precursor>.
do
initialize_execution
Precursor
end
filter_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter.