blueimp Jquery文件上传 - IE< 10

时间:2014-09-10 08:28:45

标签: javascript php jquery file-upload jquery-file-upload

这个插件在每个borwser工作正常,但IE< 10.我正在尝试将Fileupload绑定到表单中的每个操作(文本更改,文件更改,按钮推送)。在形式我有textarea(wysiwyg),文件输入和发送按钮。它应该发送带文件的文本,但它只发送文本。这是我的代码:

     $(function() {

           try{

         var messageDiv;
         if($('#account-mail-send').length){
             messageDiv = '#account-mail-send';
         } else if($('#account-mail-received').length){
             messageDiv = '#account-mail-received';
         }

        $("#message_received #form-action").submit(function(event) {
            event.preventDefault();
        });



        $('#send_form_messages #button-0').click(function(){
            if ($('#contenteditable-content').val() === '') {
               $('#message').removeClass();
               $('#message').addClass('message_ajax_negative');
               $('#message').html(empty_message_error);
            } else {
                $('#message').removeClass();
                $('#message').addClass('hide');
            }
        });

        'use strict';
        // Change this to the location of your server-side upload handler:
        var url = 'index.php?action=user_panel_ajax&mode=wyslij_wiadomosc_odebrane&id=' + $('#id').val();


        $('#attach').fileupload({
            url: url,
            dataType: 'html',
            replaceFileInput: false,
            maxNumberOfFiles: 1,
            cache: false,
            beforeSend: function(event, files, index, xhr, handler, callBack) {

                $(messageDiv).css('opacity', 0.2);
                $(messageDiv+'-loader').css({
                    height: $('#account-mail-received').css('height'),
                    width: $('#account-mail-received').css('width'),
                    display: 'block'
                });
                $('#button-0').attr('disabled', true);
                $('#attach').attr('disabled', true);

                console.log(files);
            },
            done: function(e, data) {
                $('#button-0').attr('disabled', false);
                $('#attach').attr('disabled', false);
                $(messageDiv).css('opacity', 1);
                $(messageDiv+'-loader').css({
                    display: 'none'
                });
                $(messageDiv).html(data.result);
                $('#attach').val('');
                $('#list').html('');

                $('#attach').fileupload('add', {
                    fileInput: $(this)
                });
                jqueryEditable[0].wysiwyg('focus');
                jqueryEditable[0].wysiwyg('clear');

                $('#count-chars-0').html($('#contenteditable-content').attr('maxlength'));

            },
            fail: function(e, data) {
            },
            add: function(e, data) {
                $("#button-0").off('click').one('click', function() {
                    data.submit();
                });
            }
        });

        $('#message_received #contenteditable-content').change(function() {
            if ($('#attach').val() === '') {
                $('#attach').fileupload('add', {
                    fileInput: $(this)
                });
            }
        });

}catch(e){

console.log(e);

}

    });

0 个答案:

没有答案