2017-03-10 7 views
0
<input type="file" name="default_image" id="imgInp" value="{{$property->default_image}}"> 

<div class="dropzone_upload"> 
     <div class="dz-message" data-dz-message> 
      <span> 
       <img src='/assets/home/img/cloud_upload.png'/><br/>DRAG AND DROP IMAGES HERE <br/> <span class='or'>or</span> <br/> <a href='javascript:void(0)' class='upload_images'>UPLOAD IMAGES</a> 
       </span> 
      </div>        
     </div> 

デフォルトの画像と画像をdropzoneにアップロードすると、これらの2つが混ざり合って、すべてがdefault_image []に​​配置されるという問題があります。Dropzoneと別の入力ファイルですか?

どのように私はそれを修正することができますか?

$this->validate($request,[ 
      'default_image' => 'mimes:jpeg,bmp,png|max:2000' 
      ]); 

これは、ドロップゾーンのための私の設定です:

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

    // The configuration we've talked about above 
    addRemoveLinks: true, 
    previewsContainer: '.dropzone-previews', 
    autoProcessQueue: false, 
    uploadMultiple: true, 
    parallelUploads: 10, 
    maxFiles: 10, 
    autoDiscover:false, 
    paramName:'gallery_images', 

    // The setting up of the dropzone 
    init: function() { 
     var myDropzone = this; 

     // First change the button to actually tell Dropzone to process the queue. 
     this.element.querySelector("button[type=submit]").addEventListener("click", function(e) { 
      // Make sure that the form isn't actually being sent. 
      if (myDropzone.getQueuedFiles().length > 0) { 

       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() { 
      console.log('sendingmultiple'); 
      // Gets triggered when the form is actually being sent. 
      // Hide the success button or the complete form. 

     }); 
     this.on("successmultiple", function(files, response) { 
      console.log('successmultiple error',response); 
      // Gets triggered when the files have successfully been sent. 
      // Redirect user or notify of success. 
      $("html, body").animate({ scrollTop: 0 }, "slow"); 
      $("#resultMsg").css('display', 'block').text(response.successMsg); 

     }); 
     this.on("errormultiple", function(files, response) { 
      console.log('response error',response); 
      // Gets triggered when there was an error sending the files. 
      // Maybe show form again, and notify user of error 
     }); 
    } 

}; 

答えて

0

あなたが使用する必要がある私は、このように、それはその画像がJPEG、BMP、PNGのタイプでなければならないと言うん

詳細については

$this->validate($request,[ 
    'default_image.*' => 'mimes:jpeg,bmp,png|max:2000' 
]); 

https://laravel.com/docs/5.4/validation#validating-arrays

次のように支配
関連する問題