Multiple file upload

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<!-- IMPORTANT:  FORM's enctype must be "multipart/form-data" -->
<form method="post" action="MultipleUploads.php" enctype="multipart/form-data">
  <input name="UploadFiles[]" id="UploadFiles" type="file" multiple="multiple" />
  <input type="submit" />
</form>
<?php
showVariable(compact("_FILES"));
$FilesCount = count($_FILES["UploadFiles"]["name"]);
ShowVariable(compact("FilesCount"));
/*  foreach ($_FILES["UploadFiles"]["name"] as $name) {
    ShowVariable(compact("name"));
    }*/
for ($FileIndex = 0; $FileIndex <= $FilesCount - 1; $FileIndex +=1)
 {
  $OriginalFilename = $_FILES["UploadFiles"]["name"][$FileIndex];
  ShowVariable(compact("OriginalFilename"));
  $TemporaryFilename = $_FILES["UploadFiles"]["tmp_name"][$FileIndex];
  ShowVariable(compact("TemporaryFilename"));
 }
function ShowVariable($TheVariable)
// Show the name of this variable and it's contents for debugging.
{
    $VariableName  = key($TheVariable);
    $VariableValue = $TheVariable[$VariableName];
    echo ('<p>' . $VariableName . ' is ');
    var_dump($VariableValue);
}
?>
<body>
</body>
</html>

Get size of SVG image

function GetSvgSize($ImageSvgFile)
{
$FileContents = file_get_contents($ImageSvgFile);
$doc = new DOMDocument();
$dom->preserveWhiteSpace = False;
$doc->loadXML($FileContents) or die('Failed to load SVG file ' . $ImageSvgFile . ' as XML.');
$SvgTags = $doc->getElementsByTagName('svg');
foreach ($SvgTags as $SvgTag)
{
$SvgSize["Width"] = intval($SvgTag->getAttribute('width'));
$SvgSize["Height"] = intval($SvgTag->getAttribute('height'));
}
Return $SvgSize;
}
function ShowVariable($TheVariable)
{
$VariableName = key($TheVariable);
$VariableValue = $TheVariable[$VariableName];
echo chr(60). 'p' . chr(62) . $VariableName . ' is ';
var_dump($VariableValue);
}
$SvgSize = GetSvgSize('\\\Server\Path\Image.svg');
ShowVariable(compact('SvgSize'));

Display variable contents

function ShowVariable($TheVariable) 
{
$VariableName = key($TheVariable);
$VariableValue = $TheVariable[$VariableName];
echo chr(60). 'p' . chr(62) . $VariableName . ' is ';
var_dump($VariableValue);
}
ShowVariable(compact('VariableNameWithoutDollarSign'));

Change the color of an SVG image file

function RecolorImage($ImageSvgFile, $ImageColor)
{
$FileContents = file_get_contents($ImageSvgFile);
$doc = new DOMDocument();
$dom->preserveWhiteSpace = False;
$doc->loadXML($FileContents) or die('Failed to load SVG file ' . $ImageSvgFile . ' as XML. It probably contains malformed data.');
$SvgTags = $doc->getElementsByTagName("svg");
if (preg_match('/^([0-9a-f]{1,2}){3}$/i', $ImageColor) == false)
{
die('Invalid color: ' . $ImageColor);
}
//Look at each element in the XML and add or replace it's Fill attribute to change the color.
$AllTags = $doc->getElementsByTagName("path");
foreach ($AllTags as $ATag)
{
$VectorColor = $ATag->getAttribute('fill');
if (strtoupper($VectorColor) != '#FFFFFF')
{
//This vector is not white, so change it's color.
$ATag->setAttribute('fill', '#' . $ImageColor);
$FileContents = $doc->saveXML($doc);
}
}
Return $FileContents;
}

Enumerate each row of a table from a database

while($Row = mssql_fetch_row($Table))
{
echo "<p>Row: ";
var_dump($Row);
}

Create table from database query

function GetDatabaseTable($HostName, $UserName, $Password, $DatabaseName, $QueryText)
{
$Connection = mssql_connect($HostName, $UserName, $Password) or DIE("DATABASE FAILED TO RESPOND.");
mssql_select_db($DatabaseName, $Connection) or DIE("Table unavailable");
$Table = mssql_query($QueryText);
Return $Table;
}