Skip to content

Use separate JS variable to store file, Fixes drag + drop#32

Merged
simonw merged 1 commit intosimonw:mainfrom
asg017:fix-drop
Jun 28, 2023
Merged

Use separate JS variable to store file, Fixes drag + drop#32
simonw merged 1 commit intosimonw:mainfrom
asg017:fix-drop

Conversation

@asg017
Copy link
Contributor

@asg017 asg017 commented Jun 27, 2023

Click + upload works file, but drag + dropping a file does not.

I believe it's because of this line:

The .files property is immutable, so setting .files[0] = something doesn't work. For files that were uploaded manually, this worked fine because inputFiles.files[0] was set already. But when a file was dragged + dropped, setting inputFiles.files[0] to e.dataTransfer.files[0] wouldn't work.

So, I pulled currentFile as a separate JS variable and use that as the source-of-truth.

Screen.Recording.2023-06-27.at.1.19.53.PM.mov

@simonw simonw merged commit 31b6642 into simonw:main Jun 28, 2023
simonw added a commit that referenced this pull request Jun 28, 2023
@simonw simonw added the bug Something isn't working label Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants