I'm having some problems with my current php image uploader. It seems some people are abusing it and uploading any massive file instead of just jpegs, png's and gifs which is taking a toll on my bandwidth, and I can't imagine its very safe either.
Is it possible to limit what people are allowed to upload? Also maybe by size as well?
<?php
include 'config.php';
if(isset($_POST['button']))
{
$a = $_FILES["fileField"]["name"];
$sql = "insert into image(img) values('$a')";
$pqr = mysql_query($sql);
move_uploaded_file($_FILES['fileField']['tmp_name'],"upload/".$a);
if($pqr)
{
$_SESSION['name'] = 1;
header("Location: home.php");
}
else
{
echo("Error");
}
}
ob_flush();
?>
Thank you in advance!