mirror of
				https://github.com/Frooodle/Stirling-PDF.git
				synced 2025-10-25 11:17:28 +02:00 
			
		
		
		
	Fix allowing multiple files to be dropped onto a single file input (#2359)
Fix a bug that allowed multiple files to be dropped onto a single-file input element - Fix a bug that allowed multiple files to be dropped onto a single-file input element by accepting only the first file.
This commit is contained in:
		
							parent
							
								
									25e564154e
								
							
						
					
					
						commit
						de23bb702c
					
				| @ -47,14 +47,16 @@ function setupFileInput(chooser) { | ||||
|     const dt = e.dataTransfer; | ||||
|     const files = dt.files; | ||||
| 
 | ||||
|     for (let i = 0; i < files.length; i++) { | ||||
|       allFiles.push(files[i]); | ||||
|     const fileInput = document.getElementById(elementId); | ||||
|     if (fileInput?.hasAttribute("multiple")) { | ||||
|       files.forEach(file => allFiles.push(file)); | ||||
|     } else if (fileInput) { | ||||
|       allFiles = [files[0]]; | ||||
|     } | ||||
| 
 | ||||
|     const dataTransfer = new DataTransfer(); | ||||
|     allFiles.forEach((file) => dataTransfer.items.add(file)); | ||||
| 
 | ||||
|     const fileInput = document.getElementById(elementId); | ||||
|     fileInput.files = dataTransfer.files; | ||||
| 
 | ||||
|     if (overlay) { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user