0

so i'm doing this project i got in React - and i need to upload a picture (and send it to the Database - express) im using file Reader and sending base64 string to the server ( i have npm that converts it to photo) it works perfect but i do have 1 problem, it only lets me upload small pictures / low quality images , and if the picture is too big , i get this error -

Failed to load resource: the server responded with a status of 413 (Payload Too Large)

what can i do to fix it and let it send bigger pictures?

my code in React -

async fileLoader(ev){
        if(ev.target.files[0]){
            var reader = new FileReader();
            var files = ev.target.files;
            let res = await reader.readAsDataURL(files[0]);
            debugger;
            var newFileName = files[0].name
            setTimeout(()=>{
                this.setState({fileData:reader.result , fileName:newFileName})
            }, 30)
        }
    }
Àtishking
  • 178
  • 2
  • 12

1 Answers1

0

This is a response from your server that is managing the file upload.

What HTTP server is in front of the database?

For NGINX see: nginx / 413 Request Entity Too Large

You may also need to find where the maximum file upload limits are in your node.js application.