<commit_before><?php
// summary
//		Test file to handle image uploads (remove the image size check to upload non-images)
//
//		This file handles both Flash and HTML uploads
//
//		NOTE: This is obviously a PHP file, and thus you need PHP running for this to work
//		NOTE: Directories must have write permissions
//		NOTE: This code uses the GD library (to get image sizes), that sometimes is not pre-installed in a 
//				standard PHP build. 
//
require("cLOG.php");

function trace($txt){
	//creating a text file that we can log to
	// this is helpful on a remote server if you don't
	//have access to the log files
	//
	error_log($txt);
	$log = new cLOG("../resources/upload.txt", false);
	//$log->clear();
	$log->write($txt);
}
function getImageType($filename){
	return strtolower(substr(strrchr($filename,"."),1));
}
trace("---------------------------------------------------------");
//
//
//	EDIT ME: According to your local directory structure.
// 	NOTE: Folders must have write permissions
//
$upload_path = "../resources/"; 	// where image will be uploaded, relative to this file
$download_path = "../resources/";	// same folder as above, but relative to the HTML file

//
// 	NOTE: maintain this path for JSON services
//
require("../../../dojo/tests/resources/JSON.php");
$json = new Services_JSON();


if( isset($_FILES['Filedata'])){
	//
	// If the data passed has 'Filedata', then it's Flash. That's the default fieldname used.
	//
	$returnFlashdata = true;
	move_uploaded_file($_FILES['Filedata']['tmp_name'],  $upload_path . $_FILES['Filedata']['name']);
	$file = $upload_path . $_FILES['Filedata']['name'];
	$type = getImageType($file);
	trace("file: " . $file );
	// 		Flash gets a string back:
	$data ='file='.$file.',width='.$width.',height='.$height.',type='.$type;
	if($returnFlashdata){<commit_msg>UploadFile.php was missing line to return width and height<commit_after><?php
// summary
//		Test file to handle image uploads (remove the image size check to upload non-images)
//
//		This file handles both Flash and HTML uploads
//
//		NOTE: This is obviously a PHP file, and thus you need PHP running for this to work
//		NOTE: Directories must have write permissions
//		NOTE: This code uses the GD library (to get image sizes), that sometimes is not pre-installed in a 
//				standard PHP build. 
//
require("cLOG.php");

function trace($txt){
	//creating a text file that we can log to
	// this is helpful on a remote server if you don't
	//have access to the log files
	//
	error_log($txt);
	$log = new cLOG("../resources/upload.txt", false);
	//$log->clear();
	$log->write($txt);
}
function getImageType($filename){
	return strtolower(substr(strrchr($filename,"."),1));
}
trace("---------------------------------------------------------");
//
//
//	EDIT ME: According to your local directory structure.
// 	NOTE: Folders must have write permissions
//
$upload_path = "../resources/"; 	// where image will be uploaded, relative to this file
$download_path = "../resources/";	// same folder as above, but relative to the HTML file

//
// 	NOTE: maintain this path for JSON services
//
require("../../../dojo/tests/resources/JSON.php");
$json = new Services_JSON();


if( isset($_FILES['Filedata'])){
	//
	// If the data passed has 'Filedata', then it's Flash. That's the default fieldname used.
	//
	trace("returnFlashdata.... ");
	$returnFlashdata = true;
	$m = move_uploaded_file($_FILES['Filedata']['tmp_name'],  $upload_path . $_FILES['Filedata']['name']);
	trace("moved:" . $m);
	$file = $upload_path . $_FILES['Filedata']['name'];
	list($width, $height) = getimagesize($file);
	$type = getImageType($file);
	trace("file: " . $file ."  ".$type." ".$width);
	// 		Flash gets a string back:
	$data ='file='.$file.',width='.$width.',height='.$height.',type='.$type;
	if($returnFlashdata){
{'fraction_non_alphanumeric': 0.1937680020947892, 'fraction_numerical': 0.0005236973029588898, 'mean_word_length': 3.2444444444444445, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5298360', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1167, 'n_words': 400}