Correct Syntax for uploading files to custom directory in WordPress

(Update to answer: 05.27.15) What finally worked is using ABSPATH:

$folderPath = "/jobtracking/files/standard/{$projID}";

mkdir(ABSPATH.$folderPath, 0755, true);

$filename = basename($_FILES['Attach_Files']['name']);
$filetype = $_FILES['Attach_Files']['type'];
$datei = "files/standard/{$projID}/{$filename}";
$target_path = ABSPATH.$folderPath . "https://wordpress.stackexchange.com/" . $filename;
    if(move_uploaded_file($_FILES['Attach_Files']['tmp_name'], $target_path)) {
    mysql_query("INSERT INTO files (files.name, files.project, files.user, files.added, files.datei, files.type, files.folder, files.visible) VALUES('{$filename}', '{$projID}', 5, UNIX_TIMESTAMP(now()), '{$datei}', '{$filetype}', 0, ' ')");
}
chmod("{$target_path}", 0755);

I also made sure to change the 0777 to 0755.