I'm building a simple uploadscript for my photoalbum right now and I was wondering witch checks I should include in the script??
And yes another thing, how do I check if the file that was received came from a user using the uploadform??
For reference, here's the script (it's in my native language, but i include some comments):
<?php
$uploaddir = "C://Documents and Settings//Thomas//Mijn documenten//Webdesign//uploadscript//";
$uploadfile = $uploaddir. $_FILES['userfile']['name'];
if ($_POST['submit'])
{
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
{
echo ("Het bestand is met succes upgeload naar de server!"); // if the file was succesfully moved to the server, print a message
unlink($_FILES['userfile']['tmp_name'];
} // delete temp file
else
{
echo ("Het bestand is niet upgeload naar de server! Er heeft zich een fout voorgedaan"); // if it wasn't succesfully uploaded echo an error back
unlink($_FILES['userfile']['tmp_name'];
} // delete temp file
}
?>
<?xml version="1.0" encoding="iso-8859-1"?>
<!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>
<title>[UPLOAD SCRIPT door Yame Conoces]</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000"/>
Send this file: <input name="userfile" type="file"/><br/>
<input type="submit" name="submit" value="[Verzend bestand]"/>
</form>
</body>
</html>
thx in advance 😃