(fileInput)
| 192 | } |
| 193 | |
| 194 | function wireFileInputChange(fileInput) { |
| 195 | if (!fileInput || fileInput.__uploadChangeBound) return; |
| 196 | fileInput.__uploadChangeBound = true; |
| 197 | |
| 198 | // For file picker, remove directory attributes so only files can be chosen. |
| 199 | fileInput.removeAttribute("webkitdirectory"); |
| 200 | fileInput.removeAttribute("mozdirectory"); |
| 201 | fileInput.removeAttribute("directory"); |
| 202 | fileInput.setAttribute("multiple", ""); |
| 203 | |
| 204 | fileInput.addEventListener("change", async function () { |
| 205 | const files = Array.from(fileInput.files || []); |
| 206 | if (!files.length) return; |
| 207 | |
| 208 | if (useResumable) { |
| 209 | await queueResumableFiles(files); |
| 210 | } else { |
| 211 | // Non-resumable: normal XHR path, drag-and-drop etc. |
| 212 | processFiles(files); |
| 213 | } |
| 214 | }); |
| 215 | } |
| 216 | |
| 217 | function setUploadButtonVisible(visible) { |
| 218 | const btn = document.getElementById('uploadBtn'); |
no test coverage detected