I am facing an issue with uploading PDFs via AJAX in my Spring Boot application. Most PDFs are successfully uploaded, but for 1-2 specific PDFs, I encounter a 403 Forbidden error with the message POST https://develop.abc.in/parseResume 403 (Forbidden).
The PDFs seem fine to me, and I’m struggling to identify the root cause of the problem. I have included the relevant code snippet for reference. Any insights or suggestions on what might be causing this issue would be greatly appreciated.
// ajax call for Individual add candidate resume /
function submitIndividualSharedFileInviteCandidate() {
var data = new FormData();
var files = $('#individual')[0].files
data.append('file',files[0]);
if (!validateIndividualResumeUpload()) {
return false;
}else{
if(dummyData == "DummyData"){
currentactivity_dummyData = "btn_shareEmployee_uploadIndResume";
deleteDummyData();
removeDummyData="removeDummyData";
}
}
// var data = new FormData(formdata);
var csrf = $("input[name='_csrf']").attr("value")
$.ajax({
headers : {
"X-CSRF-TOKEN" : csrf
},
enctype : 'multipart/form-data',
processData : false, // Important!
contentType : false,
cache : false, //this is my servlet
crossDomain: true, // Set this option
data : data,
type : "POST",
url : "./parseResume",
success : function(result) {
if (result.status == "Done") {
current_employee_id = result.data.employeeId;
$('#myModal').modal('hide');
// $('#candidatesBlock1').empty();
}
$(".tab-slider--navresumedetails li:nth-child(2)").trigger('click')
$(".tab-slider--navresumedetails li:nth-child(1)").css('pointer-events', 'none');
// $(".add_candidate_form_parent").css('height', '698px');
$(".add_candidate_form_parent").css('overflow', 'auto');
getSupplierEmail()
var obj = result.data;
unparsed_resumes_list = obj;
current_employee_id = obj.employeeId;
$('#userId_unparesedResume').val(obj.employeeId);
unparsedBulkSharedResumePreview(obj);
$('#btn_save_unparsedSharedBulkResumes').html('Save');
if (result.status == "error") {
$('#myModal').modal('hide');
}
},
error : function(result) {
console.log(result);
}
});
}