if ($ACT == "uploadSnap") { $pic_data = isset($R_Q['pic_data']) ? $R_Q['pic_data'] : ""; $projectwork_id = isset($R_Q['pwid']) ? $R_Q['pwid'] : ""; if ($projectwork_id != "") { $sql = "UPDATE `serv_project_tracker` SET `stop_time`=NOW() WHERE `project_id` ='getProjectID($projectwork_id)'"; run_quary($sql); $sql = "INSERT INTO `serv_project_tracker_snap` (`project_tracker_id`, `project_work_snap_time`) VALUES ('$projectwork_id', NOW());"; run_quary($sql); $idd = mysql_insert_id(); $output_file = ""; $pro_id = getProjectID($idd); $output_file = MEDPATH . $pro_id . "_" . $idd . ".jpg"; $data = $pic_data; $data = explode(",", $data); $string = implode(array_map("chr", $data)); $ifp = fopen($output_file, "wb"); fwrite($ifp, $string); fclose($ifp); echo $idd; } die(); } if($ACT=="uploadSnap2"){ $pic_data=$_FILES['pic_data']; $projectwork_id=isset($R_Q['pwid'])?$R_Q['pwid']:""; if($projectwork_id!=""){ $sql = "UPDATE `serv_project_tracker` SET `stop_time`=NOW() WHERE `project_id` ='getProjectID($projectwork_id)'"; run_quary($sql); $sql = "INSERT INTO `serv_project_tracker_snap` (`project_tracker_id`, `project_work_snap_time`) VALUES ('$projectwork_id', NOW());"; run_quary($sql); $idd=mysql_insert_id(); $output_file=MEDPATH.$idd.".jpg"; move_uploaded_file($pic_data['tmp_name'], $output_file); echo $idd; } die(); }