Re: Files types



Janwillem Borleffs wrote:
Bill schreef:
Can anyone point me in the right direction. I am trying to upload jpg images and using the following piece of code
$myerror = "no";
$msg = "ok";
$img_types = array('image/jpeg','image/jpg','image/pjpeg');
if (!in_array($_FILES['imagefile']['type'],$img_types))
{
$msg = 'Problem: file is not jpg';
$myerror = "yes";
}
echo $msg;
When I try to download a jpg I still get the problem msg.
Is there something that I am doing wrong that I cant see or is there another way to do this.
Thanks in advance


What is the output when you print $_FILES['imagefile']['type']?


JW

i tried
$newname = $_FILES['imagefile']['type'];
echo $newname;
and got nothing.
Is there something I have to do to make this work
Thanks
.



Relevant Pages

  • Re: Files types
    ... echo $msg; ... When I try to download a jpg I still get the problem msg. ... echo $newname; ... looking at the output in the browser. ...
    (alt.php)
  • Re: Files types
    ... echo $msg; ... When I try to download a jpg I still get the problem msg. ...
    (alt.php)
  • Re: How to Delete Files in Folder Which Dont Match Files in Another Folder
    ... file names are identical except for the .raw and .jpg extensions. ... I put all the .raw images in a 'RAW' folder and all the jpg images in ... @echo off ...
    (microsoft.public.scripting.vbscript)
  • Re: [PHP] if(), else() problem!
    ... Rahul S. Johari wrote: ... echo ³not found²; ... $msg = 'database contains no records!'; ... The loop reads each row in the database, ...
    (php.general)
  • Re: functions, return values, testing
    ... to echo a value which I can capture. ...  badguy fails, goodguy succeeds. ...   Later I ... command goodguy true, msg = goodguy_out ...
    (comp.unix.shell)