Here is my complete file:
<?php
include "../album_config.inc.php";
// Use Heredoc syntax to format the XHTML form
$addPhotoForm = <<<addPhotoForm
<p>Add a photo to the album</p>
<form action="add_product.php"
enctype="multipart/form-data" method="post">
<p>
Item Number:<br />
<input type="text" name="item_number" size="35" maxlength="25">
</p>
<p>
Name:<br />
<input type="text" name="name"
size="40" maxlength="100" value="" />
</p>
<p>
Description:<br />
<textarea name="description"
rows="7" cols="70"></textarea>
</p>
<p>
Price:<br />
<input type="text" name="price" size="35" maxlength="25">
</p>
<p>
Photo:<br />
<input name="thumb_link" type="file">
</p>
<p>
Category ID:<br />
<input type="text" name="catid" size="10" maxlength="5">
</p>
<p>
<input type="submit" value="Add product!" />
</p>
</form>
addPhotoForm;
// If the user has submitted a file for uploading.
if (is_uploaded_file($_FILES['thumb_link']['tmp_name'])) {
Add the photo to the MySQL database
add_product($FILES['thumb_link'],$POST['item_number'],$POST['name'],$POST['description'],$POST['price'],$POST['catid'])
or die("Could not add product");
Move the photo from the temp directory to the images directory.
move_uploaded_file($FILES['thumb_link']['tmp_name'],ABSOLUTE_PATH.$FILES['thumb_link']['name']);
echo "<p>The product was successfully uploaded to the server.</p>";
}
// display the form on every page instance
echo $addPhotoForm;
?>