質問

I am using plupload of version- 2. In a Ruby on Rails application. Browse button(that leads to the opening of a open file dialog box) is not working in Safari but everything is working fine in Firefox and Chrome. Here is the sight of my code :

    $(document).ready(function(){
            var uploader = new plupload.Uploader({
            runtimes                                        :       'html5',
            browse_button                   :       'upload-pinboard-pic',
            container                               :       'uploader_contianer',
            url                                             :       '/galleries',
            filters                                 :       [{title : "Image files", extensions : "jpg,gif,png"}],
            autostart                               :       true,
            multipart                               :       true,
            multipart_params                :       {'class_type': 'BoardPic',
                                                                            '_http_accept': 'application/javascript',
                                                                            '_method': 'post',
                                                                            'action' : 'create',
                                                                            'controller' :'galleries',
                                                                            '<%= Rails.application.config.session_options[:key] %>' : encodeURIComponent('<%= u cookies[Rails.application.config.session_options[:key]] %>'),
                                                                            'authenticity_token': '<%= form_authenticity_token %>'}
            });

            uploader.init();

            uploader.bind('FilesAdded', function(up, files){
                    if (files[0].size>1048576){
                        uploader.splice();
                        $("#dialog-confirm span").html('Photo must be less than 1 MB');
                            $("#dialog-confirm").dialog({
                            autoOpen: false,
                            resizable: false,
                            modal: true,
                            buttons: {
                                    "Ok": function() {
                                            $("#dialog-confirm").dialog("close");
                                            return false;
                                    },
                            }
                       });
                      weunite_modal_dialog();
                    }
                    else{
                    $("#uploading_image").show();
                    up.start();
                    }
            });

            uploader.bind('FileUploaded', function(up, file, info){
                    jsonObject = jQuery.parseJSON(info["response"]);
        $("#uploading_image").hide();
                    if (jsonObject['error']){
            $("#dialog-confirm span").html(jsonObject['error']);
              $( "#dialog-confirm" ).dialog({
                    autoOpen: false,
                    resizable: false,
                    modal: true,
                    buttons: {
                            "Ok": function(){
                                    $('#dialog-confirm').dialog("close");
                            }
                    }
              });
             weunite_modal_dialog();
            }else{
                    $("#uploaded-file").attr('src', jsonObject['orig_url']);
                    var url = jsonObject['orig_url'];
                    $('#board-image-file').val(url);
                    $("#newBoard-attachmentID").val(jsonObject['attachment_id']);
                   }
            });
    });

Thanks in advance.

役に立ちましたか?

解決

I don't know how it works I just change the value of the class and Id of the browse button element. May be the the Id/class conflict was the reason.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top