update
							parent
							
								
									7e45794006
								
							
						
					
					
						commit
						ef0b5a2b7e
					
				|  | @ -118,48 +118,48 @@ | ||||||
|     @endif |     @endif | ||||||
|     // $('.dropzone').on('click',function(){
 |     // $('.dropzone').on('click',function(){
 | ||||||
|         // Dropzone.autoDiscover = false; // Penting supaya tidak auto-initialize!
 |         // Dropzone.autoDiscover = false; // Penting supaya tidak auto-initialize!
 | ||||||
|     const myDropzone = new Dropzone(".dropzone", { |     // const myDropzone = new Dropzone(".dropzone", {
 | ||||||
|                 url: "{{ url('uploadTemp') }}", // URL ke controller kamu
 |     //             url: "{{ url('uploadTemp') }}", // URL ke controller kamu
 | ||||||
|                 method: "POST", |     //             method: "POST",
 | ||||||
|                 headers: { |     //             headers: {
 | ||||||
|                     'X-CSRF-TOKEN': "{{csrf_token()}}" |     //                 'X-CSRF-TOKEN': "{{csrf_token()}}"
 | ||||||
|                 }, |     //             },
 | ||||||
|                 xhrFields: { |     //             xhrFields: {
 | ||||||
|                     withCredentials: true |     //                 withCredentials: true
 | ||||||
|                 }, |     //             },
 | ||||||
|                 // maxFilesize: 1, // dalam MB
 |     //             // maxFilesize: 1, // dalam MB
 | ||||||
|                 acceptedFiles: ".pdf", |     //             acceptedFiles: ".pdf",
 | ||||||
|                 paramName: "file", // nama input file yang dikirim ke controller
 |     //             paramName: "file", // nama input file yang dikirim ke controller
 | ||||||
|                 uploadMultiple: true, |     //             uploadMultiple: true,
 | ||||||
|                 init: function() { |     //             init: function() {
 | ||||||
|                     this.on("successmultiple", function(files, response) { |     //                 this.on("successmultiple", function(files, response) {
 | ||||||
|                         // console.log('Upload success multiple:', response);
 |     //                     // console.log('Upload success multiple:', response);
 | ||||||
| 
 | 
 | ||||||
|                         const fileList = document.getElementById('file-list'); |     //                     const fileList = document.getElementById('file-list');
 | ||||||
| 
 | 
 | ||||||
|                         response.files.forEach(function(fileInfo) { |     //                     response.files.forEach(function(fileInfo) {
 | ||||||
|                             const li = document.createElement('li'); |     //                         const li = document.createElement('li');
 | ||||||
|                             li.innerHTML = `<a>${fileInfo.filename}</a>`; |     //                         li.innerHTML = `<a>${fileInfo.filename}</a>`;
 | ||||||
|                             fileList.appendChild(li); |     //                         fileList.appendChild(li);
 | ||||||
| 
 | 
 | ||||||
|                             // Tambahkan ke hidden input kalau perlu
 |     //                         // Tambahkan ke hidden input kalau perlu
 | ||||||
|                             const hiddenInput = document.createElement('input'); |     //                         const hiddenInput = document.createElement('input');
 | ||||||
|                             hiddenInput.type = 'hidden'; |     //                         hiddenInput.type = 'hidden';
 | ||||||
|                             hiddenInput.name = 'input_upload_files[]'; |     //                         hiddenInput.name = 'input_upload_files[]';
 | ||||||
|                             hiddenInput.value = fileInfo.filename; |     //                         hiddenInput.value = fileInfo.filename;
 | ||||||
|                             hiddenInput.class = 'removeFormKriteria'; |     //                         hiddenInput.class = 'removeFormKriteria';
 | ||||||
|                             var elem = '<input type="hidden" name="input_upload_files[]" value="'+fileInfo.filename+'" class="removeFormKriteria uploadedFiles is-required">'; |     //                         var elem = '<input type="hidden" name="input_upload_files[]" value="'+fileInfo.filename+'" class="removeFormKriteria uploadedFiles is-required">';
 | ||||||
|                             $('.changeForm').append(elem); |     //                         $('.changeForm').append(elem);
 | ||||||
|                         }); |     //                     });
 | ||||||
|                     }); |     //                 });
 | ||||||
| 
 | 
 | ||||||
|                     this.on("error", function(file, response) { |     //                 this.on("error", function(file, response) {
 | ||||||
|                         console.error('Upload error:', response); |     //                     console.error('Upload error:', response);
 | ||||||
|                         toastr.error(response, 'Error!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'}); |     //                     toastr.error(response, 'Error!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
 | ||||||
|                         this.removeFile(file); |     //                     this.removeFile(file);
 | ||||||
|                     }); |     //                 });
 | ||||||
|                 } |     //             }
 | ||||||
|             }); |     //         });
 | ||||||
|              |              | ||||||
|     // });
 |     // });
 | ||||||
|      |      | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue