I have tried a number of different suggestions including the suggestion on the uploadify forum: http://www.uploadify.com/forum/#/discussion/8232/upload-five-html-5-file-type-filter-capability/p1
But these do not seem to restrict the user from changing the file type. Any ideas? This is my code below:
<script type="text/javascript">
<?php $timestamp = time();?>
$(function() {
if ($('#fileupload').length > 0) {
$('#fileupload').uploadifive({
'auto' : true,
'checkScript' : '../home/assets/uploadifive/check-exists.php',
'formData' : {
'timestamp' : '<?php echo $timestamp;?>',
'token' : '<?php echo md5('unique_salt' . $timestamp);?>'
},
//'queueID' : 'queue',
'uploadScript' : '../home/assets/uploadifive/uploadifive.php',
'multi' : false,
'removeCompleted' : false,
'fileSizeLimit' : '3MB',
'uploadLimit' : 1,
'buttonText':'Select File',
onSelect: function() {
$('#btn_submit').attr({disabled: true, value:'Uploading...' }).css( "background-color", "#707070" );
},
onUploadComplete: function(file,data,reponse) {
$('#uploadedfile').val(data);
$("#btn_submit").attr({disabled: false, value:'Register' }).css( "background-color", "#D4D0C8" );
alert('The file ' + file.name + ' was successfully uploaded ');
},
// 'fileType' : 'application/pdf|application/doc|application/docx' //not
//working.
// 'fileType' : ["gif","jpeg","png"] //not working.
// 'fileType' : 'image/png|image/jpg' //not working.
// 'fileType' : 'image/*' // works but does not restrict user from changing
// it something else.
// 'fileType': ["image\/jpeg","image\/png"] // works but does not restrict user
// from changing it something else.
});
}
});
</script>
Same problem here. I've changed 'fileType' :'image', It allows whole img files but not other files (Throws forbidden file type error) and in my Php I've added $fileTypes = array('jpg', 'jpeg', 'gif', 'png'); Allowed file extensions So we can filter only jpg gif and png files. But it will increment uploaded file count uploadify.