Hola,
I have a form which is to format and upload pictures onto the server. The following code is what I have so far. I keep getting a parse error on line 49, but the script will echo the following:
File is not the right type of image.
File MIME type: image/jpeg is not a jpeg, gif, or png.
Obviously, image/jpeg IS a jpeg. I can't figure it out for the life of me. Please help!
Ras.
Code:
include ('includes.php');
$graphic = $HTTP_POST_FILES['graphic']['tmp_name'];
$graphic_name = $HTTP_POST_FILES['graphic']['name'];
$graphic_size = $HTTP_POST_FILES['graphic']['size'];
$graphic_type = $HTTP_POST_FILES['graphic']['type'];
extract($HTTP_POST_VARS);
/
error checking & formatting.
/
if ($graphic_type !="image/jpeg" || "image/gif" || "image/png")
{
echo "File is not the right type of image.<br>";
echo "File MIME type: $graphic_type is not a jpeg, gif, or png.";
exit;
}
else
{
$graphic_name = str_replace(' ', '_', $graphic_name);
}
switch($image_type)
// on the form as a radio button taken with extract() in script
{
case 'a' :
$directory = 'a';
$graphic_name = 's'.$graphic_name;
break;
case 'b' :
$directory = 'b';
$graphic_name = 'a'.$graphic_name;
break;
case 'c' :
$directory = 'c';
$graphic_name = 'p_'.$graphic_name;
break;
}
$upload = '/directory/subdirectory/images/'.$directory.'/'.$graphic_name;
Code snippet from the form:
<tr>
<td valign="top" width="33%"><input type="radio" name="image_type" value="a">a</td>
<td valign="top" width="33%"><input type="radio" name="image_type" value="b">b</td>
<td valign="top" width="33%"><input type="radio" name="image_type" value="c">c</td></tr>
<tr><td><input type="file" name="graphic" size="32"></td></tr>
</tr>