Jul 6, 2017
0
Level 21
How to upload files with laravel api
Hello. I am creating an api to upload files. But it works when I upload them through web routes file, but it doesn't work when I upload them through api routes file. Thanks in advance.
axios.defaults.headers.put['Content-Type'] = 'multipart/form-data';
axios.put('/api/pikirler', formData);
If I change it to:
axios.defaults.headers.post['Content-Type'] = 'multipart/form-data';
axios.post('/upload', formData);
It works fine.
Please or to participate in this conversation.