In the backend in laravel I have a field called "file_ticket" and I need to send an array that contains files sent through an input file, I use vue js in the frontend. How can I send this array to my backend? When I try to send only the array, the request returns something like "object file"
onChange(e) {
let getFiles = [...this.$refs.file.files]
if(!getFiles) return
([...getFiles]).forEach(f => {
this.filelist.push(f)
})
},
saveTicket(event){
event.preventDefault()
let frmData = new FormData()
frmData.append('subject', this.newTicket.subject)
frmData.append('service', this.newTicket.service)
frmData.append('description', this.newTicket.description)
frmData.append('file_ticket', this.filelist)
frmData.append('client_id', this.idUser)
const url = `ticket/new_ticket`
axios.post(url, frmData).then((response) => {
console.log(response)
})
json_decode. On the client useJSON.stringify([1, 2, 3]);, where [1, 2, 3] is your array.FormData()