supernoob basic if() question
Posted: Mon Jan 26, 2004 5:23 pm
Howdy
I have this simple little if statement that is supposed to read the filetype of a file submitted by a form and if the value of $filetype is the same as "image/pjpeg" change the value to "image/jpeg". It doesn't work. I get no error message, in fact nothing dispays on the page. As far as I can tell (supernoob here, almost no programming experience) there shouldn't be anything wrong.
Well, heres the code (snipped, relevent stuff shown):
The only issue I can possibly see is theat the filetype isn't returning "image/pjpeg".
Can someone tell me where I went wrong?
I have this simple little if statement that is supposed to read the filetype of a file submitted by a form and if the value of $filetype is the same as "image/pjpeg" change the value to "image/jpeg". It doesn't work. I get no error message, in fact nothing dispays on the page. As far as I can tell (supernoob here, almost no programming experience) there shouldn't be anything wrong.
Well, heres the code (snipped, relevent stuff shown):
Code: Select all
<?php
$filename = $_FILES['photo']['name'];
$filetype = $_FILES['photo']['type'];
echo $filetype;
if ($filetype == "image/pjpeg")
{
$filetype = "image/jpeg");
echo $filename.' is now a '.$filetype;
}
else
{
echo $filetype." is not a jpeg.";
}
?>Can someone tell me where I went wrong?