0

I have this (very simple) PHP upload script:

$pic=$_FILES['photo']['name'];
$picc=$_FILES['photo']['tmp_name'];
$tar="".$pic;
move_uploaded_file($picc,$tar);
 $fileName = $_FILES['photo']['name'];

How would I go about making the script die if it isn't an image file, or if it exceeds 1 mb?

Thanks a heck in advance! :)

1 Answers1

1

To check whether file is an image see this question:

PHP how can i check if a file is mp3 or image file?

To check filesize see this tutorial:

http://www.phpeasystep.com/phptu/3.html

Community
  • 1
  • 1
pzirkind
  • 2,338
  • 2
  • 20
  • 25