update("support_tickets", ["attachments[+]" => 1], ["id" => $ticketid]); // Now we update the answer table so we can have it in the conversation. $clientid = 0; if (isset($_REQUEST['userIDC']) && is_numeric($_REQUEST['userIDC'])) $clientid = $_REQUEST['userIDC']; $jakdb->insert("ticket_answers", ["ticketid" => $ticketid, "clientid" => $clientid, "content" => $ufile, "file" => 1, "lastedit" => $jakdb->raw("NOW()"), "sent" => $jakdb->raw("NOW()")]); // Get the file size $upfilesize = sprintf($jkl['hd140'], human_filesize($targetFile)); // success $msg = '{"status":"'.$jkl['s'].'", "filepath": "'.$targetShow.'", "filename": "'.$ufile.'", "isimage": '.$isimage.', "filesize": "'.$upfilesize.'"}'; // return json } } } else { $msg = $jkl['hd88']; } } else { $msg = $jkl['hd89']; } } else { $msg = $jkl['hd89']; } switch ($_FILES['uploadpp']['error']) { case 0: //$msg = "No Error"; // comment this out if you don't want a message to appear on success. break; case 1: $msg = "The file is bigger than this PHP installation allows"; break; case 2: $msg = "The file is bigger than this form allows"; break; case 3: $msg = "Only part of the file was uploaded"; break; case 4: $msg = "No file was uploaded"; break; case 6: $msg = "Missing a temporary folder"; break; case 7: $msg = "Failed to write file to disk"; break; case 8: $msg = "File upload stopped by extension"; break; default: $msg = "unknown error ".$_FILES['uploadpp']['error']; break; } if (isset($msg) && !empty($msg)) { $stringData = $msg; } } else { $stringData = "error"; } } else { $stringData = "error"; } echo $stringData; ?>