2015-08-19 90 views
0

我已經配置dropzone並在我的本地主機(這是一臺Windows機器)上測試它。一切正常,Laravel正在上傳和處理文件。問題是我的Web服務器上沒有發生同樣的事情。兩臺機器上的代碼都是一樣的。在窗口中,正確顯示div中的dropzone(文字說拖放文件),但在Web服務器上文本不顯示,我無法點擊該區域。Dropzone在本地主機上正常工作,在遠程服務器上拋出錯誤

Chrome dev tools say: Uncaught error: No URL provided

,即使我有配置的URL。我GOOGLE了這個錯誤,發現禁用autoDiscover應該解決它。我嘗試了這一點,但即使在本地服務器上也無法正常工作。

這是我的懸浮窗選項文件:

Dropzone.options.editFilijalaDropzone = { // The camelized version of the ID of the form element 

    // The configuration we've talked about above 
    autoProcessQueue: false, 
    uploadMultiple: true, 
    parallelUploads: 10, 
    maxFiles: 10, 
    addRemoveLinks: false, 
    acceptedFiles: '.jpeg,.jpg,.png,.gif', 
    url: "/uploadNew/filijale/filijala/" + document.getElementById('filijala_hidden').value, 
    headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, 
    // The setting up of the dropzone 
    init: function() { 
    var myDropzone = this; 
    // First change the button to actually tell Dropzone to process the queue. 
    var element = document.getElementById('edit_filijala_submit'); 
    var form = document.getElementById('edit_filijala_form'); 
    element.addEventListener("click", function(e) { 
     // 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. 
      form.submit(); 
    }); 
    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 

    }); 
    } 
} 

的HTML中的問題是:

<h1>Ažuriranje filijale za firmu: {{ $firma->naziv }}</h1> 

    <!-- if there are creation errors, they will show here --> 
    {{ HTML::ul($errors->all()) }} 

     {!! Form::model($filijala, [ 
      'method' => 'PUT', 
      'action' => array('[email protected]', $firma->id, $filijala->id), 
      'id' => 'edit_filijala_form' 
    ]) !!} 


    <div class="form-group"> 
     {!! Form::label('Naziv firme', 'Naziv firme') !!} 
     {!! Form::text('naziv_firme', $firma->naziv, array('class' => 'form-control', 'readonly')) !!} 
    </div> 

     <div class="form-group"> 
     {!! Form::hidden('filijala_hidden', $filijala->id, array('class' => 'form-control', 'id' => 'filijala_hidden')) !!} 
    </div> 

    <div class="form-group"> 
     {!! Form::label('Adresa filijale', 'Adresa filijale') !!} 
     {!! Form::text('adresa', Input::old('adresa'), array('class' => 'form-control')) !!} 
    </div> 

    <div class="form-group"> 
     {!! Form::label('Telefon', 'Telefon') !!} 
     {!! Form::text('telefon', Input::old('telefon'), array('class' => 'form-control')) !!} 
    </div> 

    <div class="form-group"> 
     {!! Form::label('Email', 'Email') !!} 
     {!! Form::text('email', Input::old('email'), array('class' => 'form-control')) !!} 
    </div> 

     <div class="form-group"> 
      {!! Form::label('Uklanjanje slika', 'Uklanjanje slika') !!} 
      <div class="row"> 
       @foreach($slike as $slika) 
        <div class="col-lg-3 col-md-4 col-xs-6 thumb"> 

          <a <?php echo 'href="#imageOverlay' . $slika->id . '"'; ?> data-toggle="drop-panel" class="thumbnail"> 
           <img <?php echo 'id="image' . $slika->id . '"'; ?> class="img-responsive" src="{{ $slika->url }}"> 
          </a> 
          <div <?php echo 'id="imageOverlay' . $slika->id . '"'; ?> class="cap-overlay show"> 
           <div class="content"> 
            <a href="javascript:obrisiSliku('{{ $slika->id }}', 'filijale')" class="button small"><h5>Obriši sliku</h5></a> 
           </div> 
          </div> 
        </div> 
       @endforeach 
      </div> 
     </div> 
     <div class="form-group"> 
       {!! $slike->render() !!} 
     </div> 

     <div class="form-group"> 
      {!! Form::label('Dodavanje slika', 'Dodavanje slika') !!} 
      <div class="dropzone" id="edit_filijala_dropzone"> 
      </div> 
     </div> 

    <div class="form-group"> 
     {!! Form::submit('Ažuriraj filijalu', array('id' => 'edit_filijala_submit')) !!} 
    </div> 

    {!! Form::close() !!} 

的服務器是CentOS的Linux機器。

編輯:

生成的HTML:

<html><head> 
    <title>Ažuriranje filijale</title> 
    <meta name="csrf-token" content="9dglsQuYuxZEcbko7sCwj8PMzQgbwFlpnfwlT5Gr"> 
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"> 
    <link rel="stylesheet" href="/css/dropzone.css"> 
    <link rel="stylesheet" href="/css/thumbnail-gallery.css"> 
    <style> 
    .cap-overlay .button { margin-top:10px} 
    .cap-overlay{width: 100%; color:#fff; background: rgba(0, 0, 0, 0.43);left:0;padding:12px; line-height: 1.4em;font-size:14px} 
    .cap-overlay h5 {color:#fff;} 
    a[data-toggle="drop-panel"] {display: block;} 
    </style> 
<style type="text/css"></style></head> 
<body> 
<div class="container"> 

<nav class="navbar navbar-inverse"> 
    <ul class="nav navbar-nav"> 
        <li><a href="http://5.189.145.111/admin_firme/2">Sve filijale za firmu</a></li> 
      <li><a href="http://5.189.145.111/admin_firme/2/filijale/create">Nova filijala</a> 
      </li></ul> 
</nav> 




<h1>Ažuriranje filijale za firmu: Kaymo PROPO LIST d.o.o                                                                                                                        </h1> 

    <!-- if there are creation errors, they will show here --> 


     <form method="POST" action="http://5.189.145.111/admin_firme/2/filijale/8" accept-charset="UTF-8" id="edit_filijala_form"><input name="_method" type="hidden" value="PUT"><input name="_token" type="hidden" value="9dglsQuYuxZEcbko7sCwj8PMzQgbwFlpnfwlT5Gr"> 


    <div class="form-group"> 
     <label for="Naziv firme">Naziv firme</label> 
     <input class="form-control" readonly="readonly" name="naziv_firme" type="text" value="Company X                                                                                                                        "> 
    </div> 

     <div class="form-group"> 
     <input class="form-control" id="filijala_hidden" name="filijala_hidden" type="hidden" value="8"> 
    </div> 

    <div class="form-group"> 
     <label for="Adresa filijale">Adresa filijale</label> 
     <input class="form-control" name="adresa" type="text" value="dsasad                                                                                                                            "> 
    </div> 

    <div class="form-group"> 
     <label for="Telefon">Telefon</label> 
     <input class="form-control" name="telefon" type="text" value="033 256 987                       "> 
    </div> 

    <div class="form-group"> 
     <label for="Email">Email</label> 
     <input class="form-control" name="email" type="text" value="[email protected]                     "> 
    </div> 

     <div class="form-group"> 
      <label for="Uklanjanje slika">Uklanjanje slika</label> 
      <div class="row"> 
            <div class="col-lg-3 col-md-4 col-xs-6 thumb"> 

          <div class="drop-panel" style="position: relative; overflow: hidden; display: block; padding: 2px;"><a href="#imageOverlay22" data-toggle="drop-panel" class="thumbnail"> 
           <img id="image22" class="img-responsive" src="\image\filijale\192971848455d4d775787cb4.79487595.jpg"> 
          </a><div id="imageOverlay22" class="cap-overlay show" style="display: block; width: 345px; height: 321px; position: absolute; z-index: 3; overflow: hidden; left: 0px; top: -321px;"> 
           <div class="content"> 
            <a href="javascript:obrisiSliku('22', 'filijale')" class="button small"><h5>Obriši sliku</h5></a> 
           </div> 
          </div></div> 

        </div> 
          </div> 
     </div> 
     <div class="form-group"> 

     </div> 

     <div class="form-group"> 
      <label for="Dodavanje slika">Dodavanje slika</label> 
      <div class="dropzone" id="edit_filijala_dropzone"> 
      </div> 
     </div> 

    <div class="form-group"> 
     <input id="edit_filijala_submit" type="submit" value="Ažuriraj filijalu"> 
    </div> 

    </form> 




</div> 
    <script src="/js/jquery.js"></script> 
    <script src="/js/jquery.hcaptions.js"></script> 
    <script src="/js/slike_akcije.js"></script> 
    <script src="/js/dropzone.js"></script> 
    <script src="/js/dropzone_options.js"></script> 
    <script> 
    $(window).load(function() { 
     $('[data-toggle=drop-panel]').hcaptions(); 
    }); 
    </script> 


</body></html> 
+0

知道錯誤將是有益的.. –

+0

@ IAM-解碼器Chrome瀏覽器開發工具之前添加此行說:'未被捕獲的錯誤:沒有提供的URL',就像問題中所寫的那樣。 – Matsura

+0

你可以發佈生成的HTML ... – Hackerman

回答

3

設置你的選擇

Dropzone.autoDiscover = false; 
+2

將jQuery onReady(「document」)之外的autoDiscover設置爲false也可能很有用。如果您等待文檔準備就緒,dropzone將嘗試在頁面中查找dropzone元素。 – Matthew

相關問題