<form method="POST" @submit.prevent="share" >
<div id="imgs">
Select Images: <input type="file" ref="file" name="file[]" multiple ></form>
share(){
var formData=new FormData();
for( var i = 0; i < this.$refs.file.files.length; i++ ){
let file = this.$refs.file.files[i];
formData.append('file[' + i + ']', file);
};
axios.post('http://localhost/11/upload_img.php',formData,{
headers:{'Content-Type':'multipart/form-data'}
}).then((res)=>{
console.log("sent");
});
}}}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.4/vue.js"></script>
<form method="POST" @submit.prevent="share" >
<div id="imgs">
Select Images: <input type="file" ref="file" name="file[]" multiple >
i send files in vue js like above and here is my PHP codes$filename=$_FILES['file']['name'];
$files=$_FILES['file'];
echo($files);
and i get this error
Notice: Undefined index: file in C:\xampp\htdocs\11\upload_img.php on line 6