System Information
- v4:
- Ubuntu 20.04:
- SQLLite:
- Node 18:
- NPM 8.6:
I thought I’d found a solution here: Problem with adding record using grapql but I think I’ve got a slightly different problem or I’m misunderstanding the solution…
Attempting to make a POST to add data and potentially multiple, currently one during testing, files in a new record. The request is coming from a React/Bootstrap frontend through Axios.
The request throws the error insert into
files_related_morphs (
field,
file_id,
order,
related_id,
related_type) values ('files', 'C:\fakepath\Screenshot from 2022-06-30 11-31-13.png', 1, 4, 'api::report.report') - FOREIGN KEY constraint failed
but creates the new record with the other data, missing only the file. The above solution seems to be referencing files that already exist within that Strapi media library, I’m trying to add entirely new ones. Am I missing something here?
Request as it comes from the frontend:
const submitReport = (name, igHandle, city, shop, description, files) => {
return axios.post("http://localhost:1337/api/reports", {data: {name, igHandle, city, shop, description, files}})
}