private function checkChunkedFile($tmpname, $chunk, $cid, $tempDir) {
		if (preg_match('/^(.+)(\.\d+_(\d+))\.part$/s', $chunk, $m)) {
			$encname = md5($cid . '_' . $m[1]);
			$part = $tempDir . '/ELF' . $encname . $m[2];
			if (is_null($tmpname)) {
				// chunked file upload fail
				foreach(glob($tempDir . '/ELF' . $encname . '*') as $cf) {
					@unlink($cf);
				}
				return;
			}
			if (move_uploaded_file($tmpname, $part)) {
				@chmod($part, 0600);
				$total = $m[3];
				$parts = array();
				for ($i = 0; $i <= $total; $i++) {
					$name = $tempDir . '/ELF' . $encname . '.' . $i . '_' . $total;
					if (is_readable($name)) {
						$parts[] = $name;
					} else {
						$parts = null;
						break;
					}
				}
				if ($parts) {
					$check = $tempDir . '/ELF' . $encname;
					if (!is_file($check)) {
						touch($check);
						if ($resfile = tempnam($tempDir, 'ELF')) {
							$target = fopen($resfile, 'wb');
							foreach($parts as $f) {
								$fp = fopen($f, 'rb');
								while (!feof($fp)) {
									fwrite($target, fread($fp, 8192));
								}
								fclose($fp);
								unlink($f);
							}
							fclose($target);
							unlink($check);
							return array($resfile, $m[1]);
						}
						unlink($check);
					}
				}
			}
		}
		return array('', '');
	}