pqina / filepond

🌊 A flexible and fun JavaScript file upload library
https://pqina.nl/filepond
MIT License
15.16k stars 825 forks source link

Simple React CRUD using Filepond #325

Closed ShriLingam23 closed 5 years ago

ShriLingam23 commented 5 years ago

Hello fellow developers!

I'm a newbie to react development!!!

I want to do file CRUD operation using filepond,please help me out. I've managed to upload file, I want to know how to read,update and delete

rikschennink commented 5 years ago

👉 https://stackoverflow.com/questions/56315933/how-to-perform-a-simple-file-crud-using-filepond

ShriLingam23 commented 5 years ago

@rikschennink
I'm the one who posted that question in Stackoverflow as well. Still I didn't get an answer for that as well.

Please help me out

rikschennink commented 5 years ago

No, that's most likely because your question is not very detailed, it doesn't show what you tried to do to solve the issue yourself, which resources you read, etc. That makes it difficult for others to help you, both because they have no information and it seems you haven't made an effort.

Remember, others have to invest their free time to help you out.

The text below is in the New issue template, you've removed this text and pasted your own, that shows me you haven't even taken the time to read the issue template.

The more details you provide, the more inclined others are to help you out and the faster the issue is resolved.

ShriLingam23 commented 5 years ago
handlePondFile(error, file) {

    if (error) {
        console.log('Oh no');
        return;
    }

    const fileId = JSON.parse(file.serverId)
    console.log('File added', fileId.id);
    this.setState({id:fileId.id})
    console.log(this.state.id)

}

handleRemove(error, file) {

    if (error) {
        console.log('Oh no');
        return;
    }

    console.log('File Removed', this.state.id);
    axios.delete('http://localhost:3001/uploadfile/'+this.state.id)
      .then(
        (res)=> console.log(res.data)
      )
}

render() 

{

    return (

      <div className="App" style={{margin:'100px'}}>

         <FilePond 
          onprocessfile={this.handlePondFile.bind(this)}
          onremovefile={this.handleRemove.bind(this)}
          name={"file"}
          server="http://localhost:3001/uploadfile"/>

      </div>
    );
}

Basically back end node server is running in localhost:3001, Now I'm able to store the file in backend database as well as delete the file I uploaded to back end database(The way I implemented delete operation is not the proper way)

Along with these I want to perform update and read operation..... Sorry for the inconvenience made :(

rikschennink commented 5 years ago

I think it would be a good idea to read the server API docs. https://pqina.nl/filepond/docs/patterns/api/server/