. */ $title = "Web Application"; $headerJavascriptLinks = array("javascript/leaflet.js"); $headerStylesheetLinks = array("css/leaflet.css"); if(array_key_exists("mapFile", $_POST)){ // upload new map to webservice if($_FILES["mapFile"]["error"] != UPLOAD_ERR_NO_FILE){ // do some checks before using the uploaded file $error = false; switch($_FILES["mapFile"]["error"]){ case UPLOAD_ERR_OK: break; case UPLOAD_ERR_NO_FILE: $errorToDisplay["title"] = "No file sent."; $error = true; break; case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: $errorToDisplay["title"] = "Exceeded filesize limit."; $error = true; default: $errorToDisplay["title"] = "Unknown errors."; $error = true; } $mapFile = sys_get_temp_dir() ."/map.mbtiles"; if(!move_uploaded_file($_FILES["mapFile"]["tmp_name"], $mapFile)){ $errorToDisplay["title"] = "Upload failed"; } else{ // send file to the webservice $upload_url = '../webservice/'; $params = array( 'map'=>"@$mapFile" ); $ch = curl_init(); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_URL, $upload_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); $response = curl_exec($ch); curl_close($ch); } } } require_once("inc/header.php"); ?>