<?
require_once('../../include/functions.php');
// JQuery File Upload Plugin v1.4.1 by RonnieSan - (C)2009 Ronnie Garcia
if (is_array($HTTP_POST_FILES['Filedata'])) {

	$tempFile = $HTTP_POST_FILES['Filedata']['tmp_name'];
	$targetPath = $_SERVER['DOCUMENT_ROOT'].$_GET['folder'].'/';
	$targetFile = str_replace('//', '/', $targetPath).cleanFileName($HTTP_POST_FILES['Filedata']['name']);

	// Uncomment the following line if you want to make the directory if it doesn't exist
	// mkdir(str_replace('//','/',$targetPath), 0755, true);

	if (move_uploaded_file($tempFile, $targetFile)) {
        echo '1';
    } else {
        echo '0';
    }
}
?>