File Upload failed #292
Replies: 1 comment 14 replies
-
Hey @AlexeySvidentsov 👋 appendFileToFormData: function( val, field ) {
this.entry[this.getInputName( field )] = {
"name": val.target.files[0].name,
"type": val.target.files[0].type,
"size": val.target.files[0].size,
}
}, That's your issue: you're manually building the expected Instead, you should make sure your GraphQL client supports the multipart file upload spec (some clients include this by default, for Apollo, you can use (You could also change your WP server config to create predictable file names for uploads, but that's easier said then done, especially if you're talking high-traffic sites, where duplicate client file names are a likelihood). |
Beta Was this translation helpful? Give feedback.
-
I'm building headless WP, and front end part of it realized with help of Vue.js Quasar framework. All form sumssions are works fine, but i can't manage to develop file upload functionality.
Here is my realisation:
Template
<input v-else-if="field.type==='FILEUPLOAD'" type="file" :name="getInputName(field)" :id="getInputId(field)" v-on:change="val=>appendFileToFormData(val, field)">
When file is selected via input i'm storing it to the Entry object
Then generate "fieldValues" input:
And sent request via axios:
My mutation look like this:
The issue is come up on the backend, when i'm reviewing entry. Uplaoded file is not accessible. There is an error:
[FAILED (Temporary file could not be copied.)]
In the Gravity Forms loggin i've this messages:
Please advise what i'm missing here?
Beta Was this translation helpful? Give feedback.
All reactions