Visualizzazione dei risultati da 1 a 5 su 5

Visualizzazione discussione

  1. #3
    Mi spiace per il titolo... pensavo risultasse chiaro.

    per il tuo suggerimento...non l'ho tanto capito...
    il codice jquery viene eseguito quando la pagina è ready.. il caricamento del file nel box dropzone.. funziona...
    è quando clicco submit che non va...


    ora ho trovato un altro esempio che tento di usare......
    in cui fa....

    document.getElementById("testbtn").addEventListene r("click", function(e) {
    alert('ok');
    // Make sure that the form isn't actually being sent.
    e.preventDefault();
    e.stopPropagation();
    myDropzone.processQueue();


    e sembra andare meglio... se riesco a finirlo.. poi posto il codice, così magari è utile ad altri




    codice:
    <form id="form_addfile" name="form_addfile" class="form-horizontal" action="#" method="post" enctype="multipart/form-data">                                        
                         <div id="dropzone-panda" class="dropzone" style="height:200px; border:1px solid #000000;"></div> <!-- This is the dropzone element -->
                        
                        
                        <div class="form-group">
                          <label class="control-label col-md-3">Titolo File</label>
                          <div class="col-md-9">
                            <input type="Titolo" class="form-control" id="titolo" name="titolo" placeholder="Titolo">
                          </div>
                        </div>    
                        <div class="form-group text-center">
                          <div class="col-md-6 col-md-offset-3">
                            <button type="submit" class="btn btn-info">salva</button>
                          </div>
                        </div>
                      </form>


    codice:
    $(document).ready(function() {     
       Dropzone.autoDiscover = false;
       
       
        
        var myDropzonePanda = new Dropzone("div#dropzone-panda", { 
            url: "/backend/schede/ajax/ajax_file.php",
            addRemoveLinks: true,
            // The configuration we've talked about above
            autoProcessQueue: false,
            uploadMultiple: true,
            parallelUploads: 100,
            maxFiles: 100,
            // The setting up of the dropzone
            init: function() {
              var myDropzone = this;
                var form = document.forms[0];
              // First change the button to actually tell Dropzone to process the queue.
              form.querySelector("button[type=submit]").addEventListener("click", function(e) {
                  alert('ok');
                // Make sure that the form isn't actually being sent.
                e.preventDefault();
                e.stopPropagation();
                myDropzone.processQueue();
              });
    
    
              // Listen to the sendingmultiple event. In this case, it's the sendingmultiple event instead
              // of the sending event because uploadMultiple is set to true.
              this.on("sendingmultiple", function() {
                // Gets triggered when the form is actually being sent.
                // Hide the success button or the complete form.
              });
              this.on("successmultiple", function(files, response) {
                // Gets triggered when the files have successfully been sent.
                // Redirect user or notify of success.
              });
              this.on("errormultiple", function(files, response) {
                // Gets triggered when there was an error sending the files.
                // Maybe show form again, and notify user of error
              });
            }
        });
    
    
       
          
    });
    Ultima modifica di Pandax; 30-04-2016 a 12:20

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.