我已經嘗試了一些不同的建議,包括對uploadify論壇的建議:http://www.uploadify.com/forum/#/discussion/8232/upload-five-html-5-file-type-filter-capability/p1UploadiFive 1.2.2使用「filetype」過濾能力/限制不起作用
但這些似乎並沒有從改變限制用戶文件類型。有任何想法嗎?這是我的代碼如下:
<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>
這工作就像一個魅力我嘗試了所有的可能性,'image/*','image/png | image/jpg',改變了屬性名稱,沒有任何工作。 –