Example #1
0
include_once('geocoder.php');

if (count($_FILES) > 0) {
	if ($_FILES["file"]["error"] > 0) {
		$error = "Error: " . $_FILES["file"]["error"] . "";
	}
	else {
		if ($_FILES["file"]["type"] !== "text/plain") {
			$error = "Error: Your file is not a text file. Your file type: ".$_FILES["file"]["type"]."";
		}
		else {
			$locations = explode("\n", file_get_contents($_FILES["file"]["tmp_name"]));
			$locations_c = array();
			foreach ($locations as $location) {
				$locations_c[] = array("location" => $location, "coordinates" => Geocoder::getLatLng($location));
			}
		}
	}	
}
else {
	$error = "Error: File missing";
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>