jquery - Uplodify onSelect event problem! -
i need validate selected file in onselect event , according modify content of uplodify element example change error style , hide progress , add description in percentage div!
problem not find uplodify content in onselect event!!!
there solution problem?
my code here :
var $max_file_size = 1024000; var $arr_allow_extention = ['.jpg', '.gif', '.png']; //console.log($arr_allow_extention); $($idselector).uploadify({ 'uploader' : $project_public_path + '/share/library/uploadify/uploadify.swf', 'script' : $project_public_path + '/share/library/uploadify/uploadify.php', 'cancelimg' : $project_public_path + '/share/library/uploadify/cancel.png', 'folder' : $project_public_path + '/uploaded_resource/bug', 'sizelimit' : $max_file_size, // 10 mb 'auto' : false, 'buttontext' : ' browse ', 'fileext' : '*.jpg;*.gif;*.png', 'filedesc' : 'web image files (.jpg, .gif, .png)', 'removecompleted' : false, 'onselect' : function(event, id, fileobj) { var $has_error = false; var $error_msg = ''; $( $idselector ).removeattr('title').removeclass(); $( $idselector ).parent().find('.check-ok, .check-error').remove(); if (fileobj.size >= $max_file_size) { //console.log( 'size over!' ); $has_error = true; $error_msg += 'maximum file size reached!'; } if ( $.inarray(fileobj.type, $arr_allow_extention) ) { $has_error = true; $error_msg += 'extention not allowed'; $($idselector + id).find('.percentage').text(" - " + $error_msg + " error"); $($idselector + id).find('.uploadifyprogress').hide(); $($idselector + id).addclass('uploadifyerror'); } if ( $has_error ) { $('#img-upload-btn').remove(); $($idselector).text(''); $( $idselector ).addclass('error'); $( $idselector ).after( "<span class=\"check-error\" title=\"" + $error_msg + "\"></span>" ); } else { $('#imgqueue').before( "<span id=\"img-upload-btn\" title=\"press upload\" class=\"button\"><img src=\"" + $project_public_path + "/share/library/uploadify/upload-btn.jpg\" style=\"display:none;\" /></span>" ); $('#img-upload-btn').click(function(){ //console.log( id ); $($idselector).uploadifyupload( id ); }); $( $idselector ).after( "<span class='check-ok'></span>" ); } } });
these line of code not work : $($idselector + id).find('.percentage').text(" - " + $error_msg + " error"); $($idselector + id).find('.uploadifyprogress').hide(); $($idselector + id).addclass('uploadifyerror');
there solution?
Comments
Post a Comment