<commit_before><?php
/*
 * This file assumes a $_FILES['file'] and a $_POST['gameID']
 * If called from the iPhone client, the file name is instead passed in $_REQUEST['fileName']
 * @returns the filename for the newly created file or an Error
*/ 
set_time_limit(0);

include ('media.php');

header('HTTP/1.1 200 OK');
header('Status: 200 OK');


$form = '
<html><body>
<form action="' . $_SERVER['PHP_SELF'] . '" 
		enctype="multipart/form-data" 
		method="post">
<p>gameID: <input type="text" name="gameID" size="30"></p>
<p>file: <input type="file" name="file" size="30"></p>
<p><input type="submit" value="Upload"></p>
<body></html>';

if (!$_FILES['file']) die ($form);


$media = new Media();

//Check for Errors
if ($_FILES['file']['error']) die ("file upload error");
		
$gameMediaDirectory = $media->getMediaDirectory($_POST['gameID'])->data;

$pathInfo = '';
if ($_REQUEST['fileName']) {
	//We are coming from the iPhone Client
	$pathInfo = pathinfo($_REQUEST['fileName']);
}
else {
	//We are coming from the form
	$pathInfo = pathinfo($_FILES['file']['name']);
}

$newMediaFileName = 'aris' . md5( date("YmdGis") . $_FILES['file']['name']) . '.' . $pathInfo['extension'];
$newMediaFilePath = $gameMediaDirectory . $newMediaFileName;

if (!move_uploaded_file( $_FILES['file']['tmp_name'], $newMediaFilePath))<commit_msg>fixed bug where uppercase file extension messed up media ul<commit_after><?php
/*
 * This file assumes a $_FILES['file'] and a $_POST['gameID']
 * If called from the iPhone client, the file name is instead passed in $_REQUEST['fileName']
 * @returns the filename for the newly created file or an Error
*/ 
set_time_limit(0);

include ('media.php');

header('HTTP/1.1 200 OK');
header('Status: 200 OK');


$form = '
<html><body>
<form action="' . $_SERVER['PHP_SELF'] . '" 
		enctype="multipart/form-data" 
		method="post">
<p>gameID: <input type="text" name="gameID" size="30"></p>
<p>file: <input type="file" name="file" size="30"></p>
<p><input type="submit" value="Upload"></p>
<body></html>';

if (!$_FILES['file']) die ($form);


$media = new Media();

//Check for Errors
if ($_FILES['file']['error']) die ("file upload error");
		
$gameMediaDirectory = $media->getMediaDirectory($_POST['gameID'])->data;

$pathInfo = '';
if ($_REQUEST['fileName']) {
	//We are coming from the iPhone Client
	$pathInfo = pathinfo($_REQUEST['fileName']);
}
else {
	//We are coming from the form
	$pathInfo = pathinfo($_FILES['file']['name']);
}

$newMediaFileName = 'aris' . md5( date("YmdGis") . strtolower($_FILES['file']['name'])) . '.' . strtolower($pathInfo['extension']);
$newMediaFilePath = $gameMediaDirectory . $newMediaFileName;

if (!move_uploaded_file( $_FILES['file']['tmp_name'], $newMediaFilePath))
{'fraction_non_alphanumeric': 0.20805860805860807, 'fraction_numerical': 0.010256410256410256, 'mean_word_length': 5.726600985221675, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7376556', 'n_tokens_mistral': 934, 'n_tokens_neox': 892, 'n_words': 240}