Yet, my script doesn't seem to accept anything other than .gif. Any suggestions?
Also, is it possible to restrict an image file dimension (example 100px x 125px)?
Code: Select all
<?
if(isset( $Submit ))
{
//If the Submitbutton was pressed do:
$image_types = Array ('image/gif', 'image/jpeg', 'image/jpg', 'image/png');
if ((in_array($_FILES['imagefile']['type'], $image_types)) &&
($_FILES['imagefile']['size'] > 15000))
{
copy ($_FILES['imagefile']['tmp_name'], "ag_thumb/".$_FILES['imagefile']['name'])
or die ("Could not copy");
echo '<table border="0" cellpadding="0" cellspacing="0" width="400">';
echo '<tr><td><img src="/main_img/6px_spacer.gif" width="6" height="6" border="0"></td></tr>';
echo '<tr><td><span class=psparkblu12><b>Name: </b>'.$_FILES['imagefile']['name'].' </span></td></tr>';
echo '<tr><td><span class=psparkblu12><b>Size: </b>'.$_FILES['imagefile']['size'].' </span></td></tr>';
echo '<tr><td><span class=psparkblu12><b>Type: </b>'.$_FILES['imagefile']['type'].' </span></td></tr>';
echo '<tr><td><img src="/main_img/6px_spacer.gif" width="6" height="6" border="0"></td></tr>';
echo '<tr><td><span class=psparkred12><b>Image Upload Complete...</b></span></td></tr>';
echo '</table>';
}
else
{
echo "";
echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")";
}
}
?>