hi guru's, i found this lil script on the web, and i want it to redo till it accepts ONLY gif files, i dont know how i can restrict it to just accept gifs, all i understand so far is that what i fill in under the "file type check" is whats NOT possible to upload....any ideas for me ?
heres the script, ty in advance
<?php
$site_name = $SERVER['HTTP_HOST'];
$url_dir = "http://".$SERVER['HTTP_HOST'].dirname($SERVER['PHP_SELF']);
$url_this = "http://".$SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
$upload_dir = "aanbieding/";
$upload_url = $url_dir."/aanbieding/";
if ($_FILES['userfile']) {
$message = do_upload($upload_dir, $upload_url);
}
else {
$message = "";
}
print $message;
function do_upload($upload_dir, $upload_url) {
$temp_name = $_FILES['userfile']['tmp_name'];
$file_name = $_FILES['userfile']['name'];
$file_type = $_FILES['userfile']['type'];
$file_size = $_FILES['userfile']['size'];
$result = $_FILES['userfile']['error'];
$file_url = $upload_url.$file_name;
$file_path = $upload_dir.$file_name;
//File Name Check
if ( $file_name =="") {
$message = "Je hebt nog geen foto geselecteerd om te uploaden :)";
return $message;
}
//File Size Check
else if ( $file_size > 500000) {
$message = "het bestand is te groot, het is meer dan 500K.";
return $message;
}
//File Type Check
else if ( $file_type == "image/gif" ) {
$message = "Sorry, ......!!" ;
return $message;
}
$result = move_uploaded_file($temp_name, $file_path);
$message = ($result)?"upload van je foto is gelukt" :
"er is iets mis gegaan, probeer het later nog eens.";
return $message;
}
?>
<form name="upload" id="upload" ENCTYPE="multipart/form-data" method="post">
Upload foto´s<input type="file" id="userfile" name="userfile">
<input type="submit" name="upload" value="Upload">
</form>