Product: FILE uploads
This commit is contained in:
@@ -10,14 +10,14 @@
|
||||
|
||||
// Cleanup deleted files
|
||||
if ($id > 0) {
|
||||
$sql = "SELECT `files` FROM md_contact WHERE company_id = :company_id AND id = :id";
|
||||
$sql = "SELECT `contact_image` FROM md_contact WHERE company_id = :company_id AND id = :id";
|
||||
$sth = $pdo2->prepare($sql);
|
||||
$sth->execute([":company_id" => $company_id, ":id" => $id]);
|
||||
$uploader->cleanup($sth->fetchColumn(), $data['keep_files'] ?? '');
|
||||
}
|
||||
|
||||
// Upload new files
|
||||
$errors = $uploader->upload('contact_files');
|
||||
$errors = $uploader->upload('contact_image');
|
||||
if (!empty($errors)) {
|
||||
$answer["success"] = 0;
|
||||
$answer["message"] = $errors[0];
|
||||
@@ -52,7 +52,7 @@
|
||||
":shipping_location"=> $data["shipping_location"],
|
||||
":shipping_address" => $data["shipping_address"],
|
||||
":remark" => $data["remark"],
|
||||
":files" => $db_image_string,
|
||||
":contact_image" => $db_image_string,
|
||||
":status" => (int)$data["status"],
|
||||
":log" => json_encode($table_log),
|
||||
];
|
||||
@@ -68,7 +68,7 @@
|
||||
`shipping_location` = :shipping_location,
|
||||
`shipping_address` = :shipping_address,
|
||||
`remark` = :remark,
|
||||
`files` = :files,
|
||||
`contact_image` = :contact_image,
|
||||
`status` = :status,
|
||||
`log` = :log
|
||||
WHERE id = :id AND company_id = :company_id";
|
||||
@@ -76,10 +76,10 @@
|
||||
} else {
|
||||
$sql = "INSERT INTO md_contact
|
||||
(company_id, contact_name, tax_id, organization, branch, contact_type,
|
||||
billing_address, shipping_location, shipping_address, remark, files, status, log)
|
||||
billing_address, shipping_location, shipping_address, remark, contact_image, status, log)
|
||||
VALUES
|
||||
(:company_id, :contact_name, :tax_id, :organization, :branch, :contact_type,
|
||||
:billing_address, :shipping_location, :shipping_address, :remark, :files, :status, :log)";
|
||||
:billing_address, :shipping_location, :shipping_address, :remark, :contact_image, :status, :log)";
|
||||
}
|
||||
|
||||
$sth = $pdo->prepare($sql);
|
||||
|
||||
Reference in New Issue
Block a user