2

I am trying to upload files using the filepond library. I am using python flask as backend.

Here is the code I am trying to use to get the files

uploaded_files = request.files.getlist("file")
print("Uplaoded Files are")
print(uploaded_files)

This keeps returning me a null array.

The following is my html code:

<form action="/", method='post',  enctype='multipart/form-data'>
<input type="file" class='filepond' name='file' multiple />
</form>

I have also linked the file pond libraries for JS and CSS.

Please help me find whats the issue.

Harshita
  • 57
  • 8

1 Answers1

1

FilePond doesn't update the original input field because unfortunately that's not possible as browsers don't allow writing to the files or value property of the field. More here: https://pqina.nl/blog/the-trouble-with-editing-and-uploading-files-in-the-browser/

Therefor you either have to upload the file asynchronously (that's what the server property is for) or you have to encode the file as a base64 string (you can use the file encode plugin to do this) and send it along a classic form post and then decode it on the server.

Rik
  • 3,328
  • 1
  • 20
  • 23