I'm in need of help in getting my pictures to upload. I've seen other code on the web that when they submit their file (i've called the name of my file "picture"), the type can be accessed by adding _type to the end. I think my script is failing because it is reading $picture_type as a variable which is empty rather than reading the type of image it is. How do I fix this? My code is as below.
Thank,
// ------------ SNIP
<?PHP
if($submit=="submit")
{
if($picture_type == 'image/gif')
{
print "GIF";
}
else if($picture_type == 'image/jpeg')
{
print "JPEG";
}
else if($picture_type == 'image/pjpeg')
{
print "PJPEG";
}
else
{
print "INVALID";
}
} // End if(submit...
print "
<table width=\"450\" border=\"0\">
<form action=\"$PHP_SELF\" method=\"post\">
<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"100000\">
<input type=\"hidden\" value=\"$mid\" name=\"mid\" value=\"mid\">
<tr>
<td colspan=\"2\" class=\"sectiontitles\">Add Management Profile</td>
</tr>
<tr>
<td colspan=\"2\" class=\"listtitles\" bgcolor=\"#484745\">Changes appear in the Management section of the website</td>
</tr>
<tr>
<td class=\"bodytext\" width=\"115\"><B>Manager Name:</b></td>
<td class=\"bodytext\" align=\"left\"><input type=\"text\" name=\"name\" size=\"30\" value=\"$name\"></td>
</tr>
<tr>
<td colspan=\"2\" class=\"bodytext\"><B>Manager Profile:</b></td>
</tr>
<tr>
<td colspan=\"2\" class=\"bodytext\"><textarea rows=\"10\" cols=\"43\" name=\"profile\">$profile</textarea></td>
</tr>
<tr>
<td colspan=\"2\" class=\"bodytext\"><B>Picture of Manager:</b></td>
</tr>
<tr>
<td colspan=\"2\" class=\"bodytext\"><input type=\"file\" name=\"picture\" size=\"57\"></td>
</tr>
<tr>
<td colspan=\"2\">
<input type=\"submit\" name=\"submit\" value=\"submit\">
<input type=\"reset\" name=\"reset\" value=\"reset\">
</td>
</tr>
</form>
</table>
";
?>
</body>
</html>