Combine normal form with filepond vuejs
See original GitHub issueI am developing using Laravel 5.6 + Vuejs and I am in doubt using Filepond 5.1.
I have a form with user data and would like to send only 1 request to the server, containing the user data with the 5 images loaded, when the user clicks the submit button, is it possible to do this with filepond?
I read some tutorials but found nothing concrete.
The request is sent, but laravel does not recognize the images field when using request->file(‘images’) on controller.
Example:
VUEJS
<form>
<input type="text" name="username">
<input type="text" name="description">
<filepond></filepond>
<button type="submit">Submit</button>
</form>
API Laravel
public function store(Request $request){
dd($request->has('files'); //Get Array Files here
}
FormComponent
<file-pond
name="images"
label-idle="Carregar Imagens ..."
allow-multiple="true"
accepted-file-types="image/jpeg, image/png"
max-files=3
server="http://localhost:3000/api/images/storeImage"
@onprocessfiles="handleSubmitImages"
@updateFiles="updatedFiles"
/>
....
<script>
data() {
return {
formData: {
username: "",//Some Additional Data
description: "",//Some Additional Data
images: [], //Array images HERE
}
};
},
methods:{
storeProduct() {
this.$store.dispatch('storeNewProduct', this.formData)
.then(response => {
...
})
.catch(error => {
...
});
},
updateFiles(files) {
this.formData.images = files; //Add Files to array Images on formData
}
</script>
VUEX
storeNewProduct(context, params) {
return new Promise((resolve, reject) => {
axios.post('/api/products', params)
.then(response => {
console.log('vuex', response.data.data)
context.commit("SET_USER_PRODUCTS",response.data.data)
resolve()
})
.catch(error => reject())
})
},
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
FilePond Documentation
The FilePond object is the object available after importing FilePond in your project. It exposes the FilePond public API which we'll mostly use...
Read more >Preview of already uploaded file in vue-filepond component
So my problem is when I want to edit my form I cant get preview of file I uploaded earlier, strange thing is...
Read more >how to deal with upload input with VueJs ?
hello iam trying to upload file and post the request to my controller but the response give me that image field required and...
Read more >Vue Image Upload Made Easy - YouTube
Vue.js is a JavaScript framework that allows us to build highly engaging web apps.Uploading images (or file upload in general) is a common...
Read more >Avatar image input component with VueJS, Inertia ... - YouTube
Every modern app I can think of has some sort of avatar or profile photo. Instead of using a basic file input to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@rikschennink, thank you for support. Finally I found a solution, thanks for the amazing package, follows my code:
FormComponent:
Vuex:
API Laravel:
I will be writing a post in the future to help other devs.
Thank you so much for your help and success.
Esto de verdad me interesa mucho no hay mucha información sobre esto, intento hacerlo de la misma forma pero solo con jQuery, aunque si se puede hacer con Vue y axios estaría bien para mi, ya que también uso Vue en el proyecto