Mit upload script ser således ud:
<?php
//Connection statement
require_once('../Connections/DB.php');
//Aditional Functions
require_once('../includes/functions.inc.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Upload</title>
</head>
<body>
<?php
if (isset($_FILES['filnavn'])) {
print "Fil der er blevet overført: {$_FILES['filnavn']['name']}<p>\n";
$query = "INSERT INTO filer SET navn='".$_FILES['filnavn']['name']."'";
$Result1 = $DB->Execute($query) or die($DB->ErrorMsg());
}
{
$tempfile = $_FILES['filnavn']['tmp_name'];
$destination = "../dokumenter/{$_FILES['filnavn']['name']} ";
copy ($tempfile, $destination);
}
?>
<form action="upload.php" method="post" enctype="multipart/form-data" name="form1">
<p>Fil, der skal overføres:
<input name="filnavn" type="file" id="filnavn">
</p>
<p>
<input type="submit" name="Submit" value="overfør">
</p>
</form>
</body>
</html>