I have a folder containing three folders. Like this:
-folder
-folder1
-demo.txt
-folder2
-folder3
The Python code for uploading looks like this:
def upload():
files = request.files.getlist('file')
taskname = request.form.get('taskname')
for file in files:
file.save('/'.join(['static', taskname, file.filename]))
The HTML form contains the following components:
<input type="file" name="files" webkitdirectory>
<button id="upload-btn" type="button">upload</button>
With the above code I get the following error:
No such file or directory: 'static/task2/folder1/demo.txt'
I didn't find similar questions and solution.
Should I parse all filenames and create the folders by hand?