2016-09-28 3 views
-1

Ich implementiere diese Upload-Bibliothek, vielleicht nicht viele Leute nutzen das, aber vielleicht kann mir jemand helfen, herauszufinden, wie man das löst.korrekte Implementierung von plupdate

So bin ich schon das Hochladen, die Sache ist, dass ich die „Uploader“ objet, wie

upload.bind(); 

ich möchte wissen, implementieren möchten hier, wenn jemand mir Links zur Verfügung stellen kann oder vielleicht meine Idee löschen .

vielen Dank.

Dies ist mein Code:

 uploader = $("#uploader").plupload({ 
     // General settings 
     runtimes: 'html5,flash,silverlight,html4', 
     url: objMaterial.geturl(), 
     urlstream_upload: true, //cambiar url en tiempo real 
     multi_selection: multiSelection, 
     unique_names: unicoNombre, 
     // User can upload no more then 20 files in one go (sets multiple_queues to false) 
     max_file_count: 1, 
     chunk_size: '1mb', 
     // Resize images on clientside if we can   
     filters: { 
      // Maximum file size 
      max_file_size: '50mb', 
      // Specify what files to browse for 
      mime_types: [ 
       { 
        title: titulo, 
        extensions: extensiones 
       } 
      ] 
     }, 
     // Rename files by clicking on their titles 
     rename: true, 
     // Sort files 
     sortable: true, 
     // Enable ability to drag'n'drop files onto the widget (currently only HTML5 supports that) 
     dragdrop: true, 
     // Views to activate 
     views: { 
      list: true, 
      thumbs: true, // Show thumbs 
      active: 'thumbs' 
     }, 
     // Flash settings 
     flash_swf_url: '../../js/Moxie.swf', 
     // Silverlight settings 
     silverlight_xap_url: '../../js/Moxie.xap' 
    }); 
    //uploader = $("#uploader").plupload(); 
    uploader = $('#uploader').plupload(); 
    console.log(uploader); 
    //uploader = $("#flash_uploader").pluploadQueue(); 

    uploader.bind('QueueChanged', function (up, files) 
    { 
     files_remaining = uploader.files.length; 
    }); 

Antwort

-1

ich diese Frage beantworten will, fand ich eine Lösung.

so sind alle diese Objekte Ereignisse.

Hier haben Sie ein komplettes Beispiel, wie Sie sie implementieren.

uploader = $("#uploader").plupload({ 
     // General settings 
     runtimes: 'html5,html4', 
     url: objMaterial.geturl(), 
     // Maximum file size 
     max_file_size: '50mb', 
     chunk_size: '1mb', 
     max_file_count: 1, 
     // Resize images on clientside if we can 
     resize: { 
      width: 200, 
      height: 200, 
      quality: 90, 
      crop: true // crop to exact dimensions 
     }, 
     // Specify what files to browse for 
     filters: [ 
      {title: "PDF", extensions: "PDF"} 
     ], 
     // Rename files by clicking on their titles 
     rename: true, 
     // Sort files 
     sortable: true, 
     // Enable ability to drag'n'drop files onto the widget (currently only HTML5 supports that) 
     dragdrop: true, 
     // Views to activate 
     views: { 
      list: true, 
      thumbs: true, // Show thumbs 
      active: 'thumbs' 
     }, 
     // Post init events, bound after the internal events 
     init: { 
      PostInit: function() { 
       // Called after initialization is finished and internal event handlers bound 
       log('[PostInit]'); 
       document.getElementById('uploadfiles').onclick = function() { 
        uploader.start(); 
        return false; 
       }; 
      }, 
      Browse: function (up) { 
                       // Called when file picker is clicked                      
                  }, 
                  Refresh: function (up) { 
                       // Called when the position or dimensions of the picker change                       
                  },  
                  StateChanged: function (up) { 
                       // Called when the state of the queue is changed                       
                  },  
                  QueueChanged: function (up) { 
                       // Called when queue is changed by adding or removing files                       
                  }, 
      OptionChanged: function (up, name, value, oldValue) { 
       // Called when one of the configuration options is changed 
      }, 
      BeforeUpload: function (up, file) { 
       // Called right before the upload for a given file starts, can be used to cancel it if required 
      }, 
                  UploadProgress: function (up, file) { 
                       // Called while file is being uploaded                       
                  }, 
      FileFiltered: function (up, file) { 
       // Called when file successfully files all the filters                       
      }, 
                  FilesAdded: function (up, files) { 
                       // Called when files are added to queue                      
                       plupload.each(files, function (file) {                            
                       }); 
                  }, 
                  FilesRemoved: function (up, files) { 
                       // Called when files are removed from queue                       
                       plupload.each(files, function (file) {                            
                       }); 
                  },  
                  FileUploaded: function (up, file, info) { 
                       // Called when file has finished uploading 
       jQueryMessage('El archivo se ha enviado exitosamente!', 1);                       
                  },  
                  ChunkUploaded: function (up, file, info) { 
                       // Called when file chunk has finished uploading                       
                  }, 
      UploadComplete: function (up, files) { 
       // Called when all files are either uploaded or failed                       
      }, 
      Destroy: function (up) { 
       // Called when uploader is destroyed                       
      }, 
                  Error: function (up, args) { 
                       // Called when error occurs                       
                  } 
         }, 
     // Flash settings 
     flash_swf_url: '/plupload/js/Moxie.swf', 
     // Silverlight settings 
     silverlight_xap_url: '/plupload/js/Moxie.xap' 
    }); 

Ich hoffe, das Ihnen helfen kann

Verwandte Themen