I am doing a project like Social media using Laravel and Vue. Here people can post up to 10 photos at a time. But I want them resized before uploading using javascript. So that I converted them into base64 string image and then send them to Laravel intervention to make image and store them.
It works when I post 1/2 or 3 photos. But It shows "405 Method Not Allowed" when I upload more than 3 photos.
Where the problems exactly occurs ? Is base64 string is too large for payload?
My route Route::post('/user/post/submit', 'PostController@storePost');
My axios post method in Vue
if (this.textInput != null || this.uploadedImages.length > 0) {
axios.post("/user/post/submit", this.file).then(res => {
//
});
}
My Base64 string
const vm = this;
if (vm.uploadedImages.length > 0) {
for (var i = 0; i < vm.uploadedImages.length; i++) {
let attachment = vm.uploadedImages[i][0];
var base64_str = attachment.replace('data:image/png;base64,', '');
var base64_str_rep = base64_str.replace(' ', '+');
if(base64_str_rep){
console.log(base64_str_rep)
vm.file.append("images["+i+"]", base64_str_rep);
}
}
}