It looks like you're new here. If you want to get involved, click one of these buttons!
$filename = $_FILES['Filedata']['name'];
$blacklist = array(\".php\",\".exe\");
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename.
if(in_array($ext,$blacklist)) {
die(\"Restricted File!\");
}
$(document).ready(function() {
$(\"#uploadify\").uploadify({
'uploader' : 'scripts/upload/uploadify.swf',
'script' : 'scripts/upload/uploadify.php',
'checkScript' : 'scripts/upload/check.php',
'cancelImg' : 'images/cancel.png',
'folder' : 'upload',
'queueID' : 'fileQueue',
'buttonText' : 'Browse',
'auto' : false,
'multi' : true,
'onSelect' : function (event, queueID, fileObj) {
var ext = fileObj.name;
ext = ext.substr(ext.length-3); //gets last 3 chars (extention type)
switch (ext) {
case 'mp3':
alert(\"Not a valid .TIFF file\");
$jQuery('#uploadify').uploadifyCancel(queueID);
break;
case 'wmv':
alert(\"Not a valid .TIFF file\");
$jQuery('#uploadify').uploadifyCancel(queueID);
break;
case 'pdf':
alert(\"Not a valid .TIFF file\");
$jQuery('#uploadify').uploadifyCancel(queueID);
break;
case 'tiff':
alert('All good continue');
break;
default:
break;
}
}
});
});function(event,queueID,fileObj){
var ext = fileObj.name;
ext = ext.substr(ext.length-4); //gets last 4 chars (extension type)
switch (ext) {
case \"jpeg\":
case \".jpg\":
case \".gif\":
// filetype ok
break;
default:
alert(\"filetype not ok\");
$jQuery(\"#uploadify\").uploadifyCancel(queueID);
break;
}
}