hi i create a simple program when input type file change, file upload to the server and get it by php but in php server doesn't return any data and $_FILES is empty
my form content type is image jpeg and shoudn't change
and request type is put
and never use formdata
here my code:
document.getElementById('filexxx').addEventListener('change',function(e){
var formdata = new FormData();
window.temp = e.target.files[0];
console.log(e.target.files[0]);
//https://divar.ir/upload_s3/temp/xxx.jpg
axios.put('http://localhost:8080/test.php', e.target.files[0], {
withToken: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoiMDkzNzUyMTA4NTciLCJleHAiOjE2MzY4Nzk1MDcuMDY3MTI2LCJ2ZXJpZmllZF90aW1lIjoxNjM1NTgzNTA3LjA2NzEzMSwidXNlci10eXBlIjoicGVyc29uYWwiLCJ1c2VyLXR5cGUtZmEiOiJcdTA2N2VcdTA2NDZcdTA2NDQgXHUwNjM0XHUwNjJlXHUwNjM1XHUwNmNjIn0.P0sfbX9pg_jOpX2zhf2H5YmIrBdXo-7NSq2ayaJIoQo',
headers: {
"Content-Type": "image/jpeg"
},
timeout: null
})
});
and my server side code in test.php
<?php
var_dump($_REQUEST);
var_dump($_FILES);