Я новичок в Vue и Laravel и пытаюсь загрузить несколько файлов, но не получаю эти файлы в базу данных. Я уже знаю, v-модель или тип не работает на ввод файла. Я стараюсь изо всех сил, но я понятия не имею, чтобы заставить его работать. Вот мой vue компонент
<v-row>
<v-col cols="12" class="d-flex flex-column">
<label for="" class="font-weight-bold pt-1">Attach Document</label>
<input type="file" @change="uploadFile($event)" class="quotationCsv">
</v-col>
</v-row>
<script>
export default {
methods: {
uploadFile(event) {
const url = 'http://127.0.0.1:3000/product/add_adjustment';
let data = new FormData();
data.append('file', event.target.files[0]);
let config = {
header: {
'content-Type' : 'image/*, application/pdf'
}
}
this.$axios.$post(url,data,config)
.then(res => {
console.log(res);
})
}
}
}
</script>
И вот мой Laravel
public function store(Request $request)
{
$data = $request->validate([
'file' => 'nullable',
]);
$quotation = new Quotation();
$quotation->file = $request ->file;
return response()->json(['created' => true]);
}