mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Fix Contact Photo not uploading when editing the first contact, odd fix but worked the edit contact forms are wrapped in a parent form on the entire table itself for Bulk changes. For some reason it wouldnt take the first edit modal form if we didnt enctype = multipart/form-data fo the parent form even though each edit subform has it already. it doesnt make sense but works
This commit is contained in:
@@ -46,7 +46,7 @@ if (isset($_POST['add_contact'])) {
|
||||
}
|
||||
|
||||
// Check for and process image/photo
|
||||
if (isset($_FILES['file']['tmp_name'])) {
|
||||
if ($_FILES['file']['tmp_name']) {
|
||||
if ($new_file_name = checkFileUpload($_FILES['file'], array('jpg', 'jpeg', 'gif', 'png'))) {
|
||||
|
||||
$file_tmp_path = $_FILES['file']['tmp_name'];
|
||||
@@ -122,21 +122,20 @@ if (isset($_POST['edit_contact'])) {
|
||||
mysqli_query($mysqli,"UPDATE contacts SET contact_name = '$name', contact_title = '$title', contact_phone = '$phone', contact_extension = '$extension', contact_mobile = '$mobile', contact_email = '$email', contact_pin = '$pin', contact_notes = '$notes', contact_important = $contact_important, contact_billing = $contact_billing, contact_technical = $contact_technical, contact_department = '$department', contact_location_id = $location_id, contact_user_id = $contact_user_id WHERE contact_id = $contact_id");
|
||||
|
||||
// Upload Photo
|
||||
if (isset($_FILES['file']['tmp_name'])) {
|
||||
if ($new_file_name = checkFileUpload($_FILES['file'], array('jpg', 'jpeg', 'gif', 'png'))) {
|
||||
if ($new_file_name = checkFileUpload($_FILES['file'], array('jpg', 'jpeg', 'gif', 'png'))) {
|
||||
|
||||
// Set directory in which the uploaded file will be moved
|
||||
$file_tmp_path = $_FILES['file']['tmp_name'];
|
||||
$upload_file_dir = "uploads/clients/$client_id/";
|
||||
$dest_path = $upload_file_dir . $new_file_name;
|
||||
// Set directory in which the uploaded file will be moved
|
||||
$file_tmp_path = $_FILES['file']['tmp_name'];
|
||||
$upload_file_dir = "uploads/clients/$client_id/";
|
||||
$dest_path = $upload_file_dir . $new_file_name;
|
||||
|
||||
move_uploaded_file($file_tmp_path, $dest_path);
|
||||
move_uploaded_file($file_tmp_path, $dest_path);
|
||||
|
||||
//Delete old file
|
||||
unlink("uploads/clients/$client_id/$existing_file_name");
|
||||
//Delete old file
|
||||
unlink("uploads/clients/$client_id/$existing_file_name");
|
||||
|
||||
mysqli_query($mysqli,"UPDATE contacts SET contact_photo = '$new_file_name' WHERE contact_id = $contact_id");
|
||||
}
|
||||
mysqli_query($mysqli,"UPDATE contacts SET contact_photo = '$new_file_name' WHERE contact_id = $contact_id");
|
||||
|
||||
}
|
||||
|
||||
// Tags
|
||||
|
||||
Reference in New Issue
Block a user