2

I have a simple reactJS application. In this app, I have a web page where I am testing the Filepond component. I also have a nodeJs server, called by the Filepond component when the file is uploaded. Here is the code when Filepond component is defined:

render() {
     return(....
       <FilePond allowMultiple={false} name='file' acceptedFileTypes='application/pdf' server='http://localhost:80/upload' uploadId=999 />
        ....
     );
}

What I want? 1 - upload a single PDF file 2 - pass the uploadId to the server when uploading the file

What is happening? => the file is uploaded but the acceptedFileTypes="application/pdf" is not taken into account because I can select any file, no matter its type

=> I am not able to pass/get the uploadId value

Any help on how I can achieve these 2 points?

Except these 2 points, the component works well and I am able to upload the file correctly.

Thank you,

Best regards

1 Answers1

0

Have you registered the plugin for validating file type? For example:

import { FilePond, registerPlugin } from 'react-filepond';
import FilePondPluginFileValidateType from 'filepond-plugin-file-validate-type';

registerPlugin(FilePondPluginFileValidateType);

class App extends React.Component { ...

Once you have installed and imported, then FilePond should do the rest on its own if you have the appropriate prop on the component.

As for the ID. What are you trying to accomplish with that? I have an implementation going to a node server and it managed to do everything I needed it to without the ID implementation.

Sharkboots
  • 174
  • 2
  • 14