Nieuw lid |
|
Zoals de title al aangeeft werkt het uploaden niet helemaal goed.
Bij mijn site kunnen leden plaatjes uploaden en nou geeft ie iedere keer een "this extension is invalid." error.
Dit is het stukje script:
<?php
if(isset($_POST['upload'])){
$map = "http://www.gangsta-world.net/images/user"; // map zonder slash
$filenaam = $_FILES['file']['name'];
$filesize = $_FILES['file']['size'];
$filetype = $_FILES['file']['type'];
$filetemp = $_FILES['file']['tmp_name'];
$ext = array('jpg','gif','png','jpeg','bmp');
$exte = explode('.', $filenaam);
$extension = $exte[count($exte) - 1];
if(!in_array($extension, $ext)){
echo "This is an invalid extension.";
}
elseif($filesize > (300 * 300)){
echo "The file is too big.";
}
else{
move_uploaded_file($filetemp, $map."/".$filenaam);
$query = "UPDATE `users` SET `image_1` = 'http://www.gangsta-world.net/images/user/".$filenaam."' WHERE `id` = '".$user['id']."'";
mysql_query($query) or die(mysql_Error());
echo "The picture has been uploaded.";
}
}
?>
<?php if(isset($_POST['upload'])){ $map = "http://www.gangsta-world.net/images/user"; // map zonder slash $filenaam = $_FILES['file']['name']; $filesize = $_FILES['file']['size']; $filetype = $_FILES['file']['type']; $filetemp = $_FILES['file']['tmp_name']; $ext = array('jpg','gif','png','jpeg','bmp'); $extension = $exte[count($exte) - 1]; echo "This is an invalid extension."; } elseif($filesize > (300 * 300)){ echo "The file is too big."; } else{ $query = "UPDATE `users` SET `image_1` = 'http://www.gangsta-world.net/images/user/".$filenaam."' WHERE `id` = '".$user['id']."'"; echo "The picture has been uploaded."; } } ?>
|