Seeking advice on how to upload a file in a VueJS application and send it to a PHP page using jQuery's ajax function. Any assistance would be greatly appreciated. My goal is to achieve this within a VueJS method (the script provided functions correctly outside of the method with the post and files array set, but not when placed inside a method). The issue seems to be that the $_FILES and $_POST arrays are not properly set. I am hoping to accomplish this without relying on external libraries like axios, only utilizing jQuery if possible. Can anyone confirm if this is feasible in VueJS?
$(document).ready(function(){
$('#addTemplateForm').on('submit', function(e){
e.preventDefault();
app.sub=true;
if(app.name!='' && app.thumbnailName!='' && app.renderTime!=''
&& app.textFieldCount!='' && app.selectedCategories.length!=0 && app.selectedKeywords.length!=0)
$.ajax({
url:'addTemplateBackend.php',
type:'POST',
dataType: 'json',
data: new FormData(this),
contentType: false,
processData: false,
error: function(data){
alert('error');
},
success: function(data){
alert('success');
console.log(data);
}
})
});
});