Picture Upload Problem

data should contain the data you want to update, in case you are making a request to an API /clients, and you want to update the client’s Firstname and Avatar that would be:

formData.append(‘files’, this.file); //avatar here, as file
formData.append(‘data’, '{"firstname":"Sunny Son"}'); //other Clients fields that need to be updated

Please note that in this case the object for data should be stringified when you are sending also the file. This is why I put it between single quotes.

1 Like