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