<?php

$mode = $_GET['mode'];

if (!isset($mode)) $mode="HTML";

if ($mode=="HTML")
{
$get_file_html=<<<EOD
<html>
<body>
<h2>Did you convert .icv file to raw PHP file by selecting "Publish to Web" from Dashboard Desinger?</h2>
<h2>If yes, then you need to upload the raw PHP file to the dashboard server</h2>

<form enctype="multipart/form-data" action="uploader.php?mode=UPLOAD" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="500000" />
Choose the raw PHP file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
</body>
</html>
EOD;

echo $get_file_html;

}
else if ($mode="UPLOAD")
{

$target_path = "raw_uploaded/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    /*echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded";
	*/
	header('Location: convert2web.php?raw_file=raw_uploaded/reservationdashboard.php');
} else{
    echo "There was an error uploading the file, please try again!";
}

}
?>