<?php
  header('Content-Type: text/html; charset=utf-8');
  include "logger.php";
  include "settings.php";
  //ob_start("ob_gzhandler");
  //ini_set('zlib.output_compression', 'On');
	
	writeToLogFile( ' -> '.date('Y-m-d H:i:s').' <> synchroAndroid <> '.$_SERVER['REMOTE_ADDR'] );
	
	foreach($_FILES as $key => $value) {
		writeToLogFile( ' -> '.date('Y-m-d H:i:s').' <> synchroAndroid <> _FILES parameter: '.$key.' has '.$value );
		
		writeToLogFile( ' -> '.date('Y-m-d H:i:s').' <> synchroAndroid <> _FILES parameter name : '.$_FILES[$key]['name'] );
		writeToLogFile( ' -> '.date('Y-m-d H:i:s').' <> synchroAndroid <> _FILES parameter tmp_name : '.$_FILES[$key]['tmp_name'] );
		writeToLogFile( ' -> '.date('Y-m-d H:i:s').' <> synchroAndroid <> _FILES parameter size : '.$_FILES[$key]['size'] );
		writeToLogFile( ' -> '.date('Y-m-d H:i:s').' <> synchroAndroid <> _FILES parameter type : '.$_FILES[$key]['type'] );
		
		//$dir = $_SERVER['DOCUMENT_ROOT']."/Logist/files/";
		$dir = $IMAGE_PATH2;
		
		//$filename = time().'.'.pathinfo($_FILES[$key]['name'], PATHINFO_EXTENSION);
		$filename = $_FILES[$key]['name'];
		
		writeToLogFile( ' -> '.date('Y-m-d H:i:s').' <> synchroAndroid dir '.$dir.$filename );
		
		if(!move_uploaded_file($_FILES[$key]['tmp_name'], $dir.$filename) ){      
				writeToLogFile( ' -> '.date('Y-m-d H:i:s').' <> synchroAndroid error move_uploaded_file' );
				echo false; exit;
		}else{
				writeToLogFile( ' -> '.date('Y-m-d H:i:s').' <> synchroAndroid success move_uploaded_file' );
				echo true; exit;
		}
	}
		
	
?>