Latest

Thursday, July 6, 2017

How to upload files through laravel api routes

Asked by: Azat Akmyradov


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.

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. But I want to use it in api routes. Thanks in advance.



Source

No comments:

Post a Comment

Adbox