File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -145,4 +145,18 @@ def resetDefaultPrograms():
145
145
if filename .endswith (".json" ):
146
146
with open ("data/defaults/programs/" + filename ) as p :
147
147
q = p .read ()
148
- programs .insert (json .loads (q ))
148
+ programs .insert (json .loads (q ))
149
+
150
+ def uploadFile ():
151
+ if 'file' not in request .files :
152
+ return 'Bad request' , 400
153
+ file = request .files ['file' ]
154
+ if file .filename == '' :
155
+ return 'Bad request' , 400
156
+ if file :
157
+ filename = file .filename
158
+ folderPath = 'uploads'
159
+ file .save (os .path .join (folderPath , filename ))
160
+ return 200
161
+ else :
162
+ return 400
Original file line number Diff line number Diff line change @@ -74,7 +74,19 @@ paths:
74
74
description : " ok"
75
75
400 :
76
76
description : " Failed to save the activity"
77
-
77
+ /uploadFile :
78
+ post :
79
+ operationId : " api.uploadFile"
80
+ parameters :
81
+ - in : body
82
+ name : data
83
+ schema :
84
+ type : object
85
+ responses :
86
+ 200 :
87
+ description : " ok"
88
+ 400 :
89
+ description : " upload failed"
78
90
/deleteActivity :
79
91
post :
80
92
operationId : " api.deleteActivity"
@@ -225,4 +237,4 @@ paths:
225
237
description : Duration of the movement. -1 moves the bot until a /stop command is received.
226
238
responses :
227
239
200 :
228
- description : Sent command to the bot GPIO.
240
+ description : Sent command to the bot GPIO.
You can’t perform that action at this time.
0 commit comments