plupload からアップロード スクリプトを取得しました。何かを編集したいのですが、方法がわかりません。一部の種類のファイルのみを許可する代わりに、 、 php、exe、cmd、bat などの一部の拡張子のみを制限したい。
var uploader = new plupload.Uploader({
runtimes : 'html5,flash,silverlight', // Set runtimes, here it will use HTML5, if not supported will use flash, etc.
browse_button : 'pickfiles', // The id on the select files button
multi_selection: false, // Allow to select one file each time
container : 'uploader', // The id of the upload form container
max_file_size : '800kb', // Maximum file size allowed
url : 'upload.php', // The url to the upload.php file
flash_swf_url : 'js/plupload.flash.swf', // The url to thye flash file
silverlight_xap_url : 'js/plupload.silverlight.xap', // The url to the silverlight file
filters : [ {extensions : "zip,rar,jpg,gif,png,jpeg,"} ] // Filter the files that will be showed on the select files window
});
フィルターを制限に変更したい。誰でも私を助けてもらえますか?
@Luan、解決策を見つけました
if( invalidExtensions.indexOf(extension) >= 0 ){
alert("the extension " + extension + " is invalid!");
up.removeFile( files[i] );
location.reload();
}
ありがとう