Я использую библиотеку форм и зон сброса для загрузки документа и проверяю, фиксируется ли идентификатор моего документа или нет. Он не захватывает, и когда я проверяю и вижу, что проблема в том, что моя библиотека Dropzone формы предотвращает это, и я не знаю, почему. Буду признателен за любую помощь в выявлении проблемы.
Это мой код
var tblCandidateDocumentList = $('#tblCandidateDocumentList').DataTable({
ajax: {
"url": "action/fn_espdb_getData.php?mod=candidateDocumentList",
"dataSrc": "candidateDocumentList"
},
columns: [
{ data: null },
{data: null},
{ data: 'document_type_name' },
{
data: null,
render: function (data, type, row) {
return `
Drop files here or click to upload
`;
}
},
],
columnDefs: [
{
// For Checkboxes
targets: 0,
searchable: false,
orderable: false,
render: function () {
return '';
},
checkboxes: {
selectRow: true,
selectAllRender: ''
}
},
],
order: [[1, 'desc']],
dom: '',
language: {
paginate: {
next: '',
previous: ''
}
},
select: {
style: 'multi'
}
});
Это мой внутренний код
case "addCandidateDetails":
// Collect form data
$candidateID = $_POST['candidateID'] > 0 ? $_POST['candidateID'] : NULL;
$candidateName = $_POST['candidateName'] == "" ? NULL : $_POST['candidateName'];
$candidateNationality = $_POST['candidateNationality'] == "" ? NULL : $_POST['candidateNationality'];
$candidateGender = $_POST['candidateGender'] == "" ? NULL : $_POST['candidateGender'];
$candidateMaritalStatus = $_POST['candidateMaritalStatus'] == "" ? NULL : $_POST['candidateMaritalStatus'];
$candidateDOB = $_POST['candidateDOB'] == "" ? NULL : $_POST['candidateDOB'];
$candidateAge = $_POST['candidateAge'] == "" ? NULL : $_POST['candidateAge'];
$candidateEmail = $_POST['candidateEmail'] == "" ? NULL : $_POST['candidateEmail'];
$candidateCompany = $_POST['candidateCompany'] == "" ? NULL : $_POST['candidateCompany'];
$candidatePassportNo = $_POST['candidatePassportNo'] == "" ? NULL : $_POST['candidatePassportNo'];
$candidatePassportIssueDate = $_POST['candidatePassportIssueDate'] == "" ? NULL : $_POST['candidatePassportIssueDate'];
$candidatePassportExpiryDate = $_POST['candidatePassportExpiryDate'] == "" ? NULL : $_POST['candidatePassportExpiryDate'];
$candidatePlaceOfIssue = $_POST['candidatePlaceOfIssue'] == "" ? NULL : $_POST['candidatePlaceOfIssue'];
$inMalaysia = $_POST['inMalaysia'] == "" ? NULL : $_POST['inMalaysia'];
$visaCollectionCenter = $_POST['visaCollectionCenter'] == "" ? NULL : $_POST['visaCollectionCenter'];
$candidatePermitType = $_POST['candidatePermitType'] == "" ? NULL : $_POST['candidatePermitType'];
// Additional data for tbl_candidate_documents
$documentTypeID = $_POST['documentTypeID'] == "" ? NULL : $_POST['documentTypeID'];
// File upload handling
$uploadDirectory = '/uploads/candidate_files/';
$uploadedFilePath = NULL;
echo "Candidate Name : " . $candidateName . "
";
echo "candidate Nationality : " . $candidateNationality . "
";
echo "Candidate Permit Type : " . $candidatePermitType . "
";
echo "Candidate Document ID : " . $documentTypeID . "
";
exit();
if (isset($_FILES['candidateFile']) && $_FILES['candidateFile']['error'] == UPLOAD_ERR_OK) {
$fileTmpPath = $_FILES['candidateFile']['tmp_name'];
$fileName = $_FILES['candidateFile']['name'];
$fileExtension = pathinfo($fileName, PATHINFO_EXTENSION);
// Sanitize candidate name and passport number for the filename
$sanitizedCandidateName = preg_replace("/[^a-zA-Z0-9]/", "_", $candidateName);
$sanitizedPassportNo = preg_replace("/[^a-zA-Z0-9]/", "_", $candidatePassportNo);
// Construct the new file name
$newFileName = "{$sanitizedCandidateName}_{$sanitizedPassportNo}_Document.{$fileExtension}";
$uploadedFilePath = $uploadDirectory . $newFileName;
// Move file to the destination
if (move_uploaded_file($fileTmpPath, $_SERVER['DOCUMENT_ROOT'] . $uploadedFilePath)) {
// Insert file details into tbl_candidate_documents
DB::insert('tbl_candidate_documents', [
'candidate_id' => $candidateID,
'document_type_id' => $documentTypeID,
'permit_id' => $candidatePermitType,
'document_name' => $newFileName,
'document_path' => $uploadedFilePath,
'status' => 1,
'entry_user' => $username,
'entry_date' => DB::sqlEval('NOW()')
]);
} else {
die('Error uploading file.');
}
}
// Insert candidate details into tbl_candidate
DB::insert('tbl_candidate', [
'candidate_id' => $candidateID,
'candidate_name' => $candidateName,
'candidate_nationality' => $candidateNationality,
'candidate_gender' => $candidateGender,
'candidate_dob' => $candidateDOB,
'candidate_age' => $candidateAge,
'candidate_email' => $candidateEmail,
'candidate_customer' => $candidateCompany,
'candidate_passport_no' => $candidatePassportNo,
'passport_issue_date' => $candidatePassportIssueDate,
'passport_expiry_date' => $candidatePassportExpiryDate,
'candidate_issue_place' => $candidatePlaceOfIssue,
'candidate_is_in_malaysia' => $inMalaysia,
'candidate_visa_collection_center' => $visaCollectionCenter,
'candidate_permit_type_id' => $candidatePermitType,
'status' => 1,
'entry_user' => $username,
'entry_date' => DB::sqlEval('NOW()')
]);
break;
Подробнее здесь: https://stackoverflow.com/questions/791 ... ne-library
Идентификатор документа не фиксируется в форме с использованием библиотеки Dropzone. ⇐ Jquery
Программирование на jquery
1731056570
Anonymous
Я использую библиотеку форм и зон сброса для загрузки документа и проверяю, фиксируется ли идентификатор моего документа или нет. Он не захватывает, и когда я проверяю и вижу, что проблема в том, что моя библиотека Dropzone формы предотвращает это, и я не знаю, почему. Буду признателен за любую помощь в выявлении проблемы.
Это мой код
var tblCandidateDocumentList = $('#tblCandidateDocumentList').DataTable({
ajax: {
"url": "action/fn_espdb_getData.php?mod=candidateDocumentList",
"dataSrc": "candidateDocumentList"
},
columns: [
{ data: null },
{data: null},
{ data: 'document_type_name' },
{
data: null,
render: function (data, type, row) {
return `
[i]
Drop files here or click to upload
`;
}
},
],
columnDefs: [
{
// For Checkboxes
targets: 0,
searchable: false,
orderable: false,
render: function () {
return '';
},
checkboxes: {
selectRow: true,
selectAllRender: ''
}
},
],
order: [[1, 'desc']],
dom: '',
language: {
paginate: {
next: '[/i]',
previous: '[i][/i]'
}
},
select: {
style: 'multi'
}
});
Это мой внутренний код
case "addCandidateDetails":
// Collect form data
$candidateID = $_POST['candidateID'] > 0 ? $_POST['candidateID'] : NULL;
$candidateName = $_POST['candidateName'] == "" ? NULL : $_POST['candidateName'];
$candidateNationality = $_POST['candidateNationality'] == "" ? NULL : $_POST['candidateNationality'];
$candidateGender = $_POST['candidateGender'] == "" ? NULL : $_POST['candidateGender'];
$candidateMaritalStatus = $_POST['candidateMaritalStatus'] == "" ? NULL : $_POST['candidateMaritalStatus'];
$candidateDOB = $_POST['candidateDOB'] == "" ? NULL : $_POST['candidateDOB'];
$candidateAge = $_POST['candidateAge'] == "" ? NULL : $_POST['candidateAge'];
$candidateEmail = $_POST['candidateEmail'] == "" ? NULL : $_POST['candidateEmail'];
$candidateCompany = $_POST['candidateCompany'] == "" ? NULL : $_POST['candidateCompany'];
$candidatePassportNo = $_POST['candidatePassportNo'] == "" ? NULL : $_POST['candidatePassportNo'];
$candidatePassportIssueDate = $_POST['candidatePassportIssueDate'] == "" ? NULL : $_POST['candidatePassportIssueDate'];
$candidatePassportExpiryDate = $_POST['candidatePassportExpiryDate'] == "" ? NULL : $_POST['candidatePassportExpiryDate'];
$candidatePlaceOfIssue = $_POST['candidatePlaceOfIssue'] == "" ? NULL : $_POST['candidatePlaceOfIssue'];
$inMalaysia = $_POST['inMalaysia'] == "" ? NULL : $_POST['inMalaysia'];
$visaCollectionCenter = $_POST['visaCollectionCenter'] == "" ? NULL : $_POST['visaCollectionCenter'];
$candidatePermitType = $_POST['candidatePermitType'] == "" ? NULL : $_POST['candidatePermitType'];
// Additional data for tbl_candidate_documents
$documentTypeID = $_POST['documentTypeID'] == "" ? NULL : $_POST['documentTypeID'];
// File upload handling
$uploadDirectory = '/uploads/candidate_files/';
$uploadedFilePath = NULL;
echo "Candidate Name : " . $candidateName . "
";
echo "candidate Nationality : " . $candidateNationality . "
";
echo "Candidate Permit Type : " . $candidatePermitType . "
";
echo "Candidate Document ID : " . $documentTypeID . "
";
exit();
if (isset($_FILES['candidateFile']) && $_FILES['candidateFile']['error'] == UPLOAD_ERR_OK) {
$fileTmpPath = $_FILES['candidateFile']['tmp_name'];
$fileName = $_FILES['candidateFile']['name'];
$fileExtension = pathinfo($fileName, PATHINFO_EXTENSION);
// Sanitize candidate name and passport number for the filename
$sanitizedCandidateName = preg_replace("/[^a-zA-Z0-9]/", "_", $candidateName);
$sanitizedPassportNo = preg_replace("/[^a-zA-Z0-9]/", "_", $candidatePassportNo);
// Construct the new file name
$newFileName = "{$sanitizedCandidateName}_{$sanitizedPassportNo}_Document.{$fileExtension}";
$uploadedFilePath = $uploadDirectory . $newFileName;
// Move file to the destination
if (move_uploaded_file($fileTmpPath, $_SERVER['DOCUMENT_ROOT'] . $uploadedFilePath)) {
// Insert file details into tbl_candidate_documents
DB::insert('tbl_candidate_documents', [
'candidate_id' => $candidateID,
'document_type_id' => $documentTypeID,
'permit_id' => $candidatePermitType,
'document_name' => $newFileName,
'document_path' => $uploadedFilePath,
'status' => 1,
'entry_user' => $username,
'entry_date' => DB::sqlEval('NOW()')
]);
} else {
die('Error uploading file.');
}
}
// Insert candidate details into tbl_candidate
DB::insert('tbl_candidate', [
'candidate_id' => $candidateID,
'candidate_name' => $candidateName,
'candidate_nationality' => $candidateNationality,
'candidate_gender' => $candidateGender,
'candidate_dob' => $candidateDOB,
'candidate_age' => $candidateAge,
'candidate_email' => $candidateEmail,
'candidate_customer' => $candidateCompany,
'candidate_passport_no' => $candidatePassportNo,
'passport_issue_date' => $candidatePassportIssueDate,
'passport_expiry_date' => $candidatePassportExpiryDate,
'candidate_issue_place' => $candidatePlaceOfIssue,
'candidate_is_in_malaysia' => $inMalaysia,
'candidate_visa_collection_center' => $visaCollectionCenter,
'candidate_permit_type_id' => $candidatePermitType,
'status' => 1,
'entry_user' => $username,
'entry_date' => DB::sqlEval('NOW()')
]);
break;
Подробнее здесь: [url]https://stackoverflow.com/questions/79169389/document-id-is-not-capturing-in-form-using-dropzone-library[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия