Workin file upload
This commit is contained in:
@@ -23,8 +23,8 @@ feature {NONE} -- Initialization
|
||||
make (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Initialize
|
||||
do
|
||||
control_name:=req.request_time_stamp.out
|
||||
make_control ( "body")
|
||||
control_name := req.request_time_stamp.out
|
||||
make_control ("body")
|
||||
request := req
|
||||
response := res
|
||||
initialize_controls
|
||||
@@ -69,16 +69,21 @@ feature -- Implementation
|
||||
event := get_parameter ("event")
|
||||
event_parameter := get_parameter ("event_parameter")
|
||||
if attached event and attached event_control_name and attached control then
|
||||
create states.make_empty
|
||||
request.read_input_data_into (states)
|
||||
create json_parser.make_parser (states)
|
||||
if attached {JSON_OBJECT} json_parser.parse_json as sp then
|
||||
set_state (sp)
|
||||
else
|
||||
if attached request.form_parameter ("file") as o then
|
||||
response.put_string (o.name)
|
||||
if not event.is_equal ("uploadfile") then
|
||||
create states.make_empty
|
||||
request.read_input_data_into (states)
|
||||
create json_parser.make_parser (states)
|
||||
if attached {JSON_OBJECT} json_parser.parse_json as sp then
|
||||
set_state (sp)
|
||||
end
|
||||
|
||||
else
|
||||
if attached request.form_parameter ("state") as statedata then
|
||||
create json_parser.make_parser (statedata.as_string.value)
|
||||
if attached {JSON_OBJECT} json_parser.parse_json as sp then
|
||||
set_state (sp)
|
||||
end
|
||||
end
|
||||
event_parameter:=request.uploaded_files
|
||||
end
|
||||
handle_callback (event_control_name.split ('-'), event, event_parameter)
|
||||
create states_changes.make
|
||||
@@ -128,7 +133,6 @@ feature -- Implementation
|
||||
Result.append (");page.initialize();});</script>")
|
||||
Result.append ("</div>")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
read_state_changes (states: WSF_JSON_OBJECT)
|
||||
@@ -152,7 +156,7 @@ feature -- Implementation
|
||||
|
||||
feature -- Event handling
|
||||
|
||||
handle_callback (cname: LIST[STRING]; event: STRING; event_parameter: detachable ANY)
|
||||
handle_callback (cname: LIST [STRING]; event: STRING; event_parameter: detachable ANY)
|
||||
-- Forward callback to control
|
||||
do
|
||||
control.handle_callback (cname, event, event_parameter)
|
||||
@@ -185,8 +189,10 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
||||
Result.put (controls_state, "controls")
|
||||
Result.put (state, "state")
|
||||
end
|
||||
|
||||
feature
|
||||
control_name:STRING
|
||||
|
||||
control_name: STRING
|
||||
|
||||
feature {NONE} -- Root control
|
||||
|
||||
|
||||
Reference in New Issue
Block a user