示例#1
0
/** @access private */
function _reason_get_disco_uploaded_file($name, $async_sid, $want_original = false)
{
    $upload = reason_get_uploaded_file($name, $async_sid);
    if (!$upload || !$upload->get_filename()) {
        return null;
    }
    $path = null;
    if ($want_original) {
        $path = $upload->get_original_path();
    }
    if (!$path) {
        $path = $upload->get_temporary_path();
    }
    return array("name" => $upload->get_filename(), "path" => $path, "tmp_name" => $path, "original_path" => $upload->get_original_path(), "modified_path" => $upload->get_temporary_path(), "size" => filesize($path), "type" => $upload->get_mime_type("application/octet-stream"));
}
示例#2
0
		return "[".implode(', ', array_map('json_encode', $data))."]";
	}
	
	function _json_encode_object($object)
	{
		$pairs = array();
		foreach ((array) $object as $key => $value) {
			$pairs[] = json_encode((string) $key).': '.json_encode($value);
		}
		return "{".implode(', ', $pairs)."}";
	}
}

$response = array();
foreach (array_keys($_FILES) as $name) {
	$file = reason_get_uploaded_file($name);
	$filename = $file->get_filename();
	
	$constraints = (!empty($session['constraints'][$name]))
		? $session['constraints'][$name]
		: null;
	
	if ($constraints) {
		check_constraints($constraints, $file);
	}
	
	$m = array();
	if (preg_match('/((?:\.tar)?\.[a-zA-Z0-9]+)$/', $filename, $m)) {
		$extension = strtolower($m[0]);
	} else {
		$extension = '';