Specifications

LISTING 28.15 Continued
do_html_footer();
exit;
}
// creating directory will fail if this is not the first message archived
// that’s ok
@ mkdir(“archive/$list”, 0700);
// it is a problem if creating the specific directory for this mail fails
if(!mkdir(“archive/$list/$mailid”, 0700))
{
do_html_footer();
exit;
}
// iterate through the array of uploaded files
$i = 0;
while ($userfile[$i]&&$userfile[$i]!=’none’)
{
echo “<p>Uploading “.$userfile_name[$i].” - “;
echo $userfile_size[$i].” bytes.<br>”;
if ($userfile_size[$i]==0)
{
echo “Problem: $userfile_name[$i] is zero length”;
$i++;
continue;
}
if ($userfile_size[$i]>$max_size)
{
echo “Problem: $userfile_name[$i] is over 10000 bytes”;
$i++;
continue;
}
// we would like to check that the uploaded image is an image
// if getimagesize() can work out Web size, it probably is.
if($i>1&&!getimagesize($userfile[$i]))
{
echo “Problem: $userfile_name[$i] is corrupt, or not a gif, jpeg or png”;
$i++;
continue;
}
// file 0 (the text message) and file 1 (the html message) are special
//cases
Building Practical PHP and MySQL Projects
P
ART V
700
34 7842 CH28 3/6/01 3:46 PM Page 700