make file out ouf string to combine flow content updates via editor and fileupload

This commit is contained in:
Clemens 2016-07-13 20:18:04 +02:00
parent f84098554a
commit 121079934e
2 changed files with 3 additions and 4 deletions

View File

@ -297,12 +297,9 @@ class FlowContent(RequestHandler):
flow = self.flow
flow.backup()
content = ''
content = 'Can not read file!'
if (len(self.request.files.values()) > 0):
content = self.request.files.values()[0][0]["body"]
elif (len(self.request.arguments) > 0):
content = self.request.arguments['file']
flow.response.content = str(content)
self.state.update_flow(flow)

View File

@ -119,6 +119,8 @@ export function update(flow, data) {
export function update_content(flow, file) {
const body = new FormData()
if (typeof file !== File)
file = new Blob([file], {type: 'plain/text'})
body.append('file', file)
fetchApi(`/flows/${flow.id}/response/content`, {method: 'post', body} )
return { type: REQUEST_ACTION }