-
After I release a file in the drop zone, the browser open the file. I added const Page = () => {
const preventOpenFile = (e) => e.preventDefault()
return (
<label style={{ display: 'flex', background: 'red', width: '100%', height: '16rem' }}>
<input type="file" style={{ display: 'none' }} onDrop={preventOpenFile} onDragOver={preventOpenFile} />
</label>
)
} I did a try with With Registrazione.dello.schermo.2024-09-18.095557.mp4 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Can you share some screenshots (gif, short video)? Does it behave like you drop a file into a blank page? |
Beta Was this translation helpful? Give feedback.
-
Solid uses deferred events for |
Beta Was this translation helpful? Give feedback.
-
I solved with: const Page = () => {
return (
<div>
<label
style={{ display: 'flex', background: 'red', width: '100%', height: '16rem' }}
onDragOver={(event) => {
event.preventDefault()
event.stopPropagation()
}}
onDrop={(event) => {
event.preventDefault()
event.stopPropagation()
const files = event.dataTransfer!.files
// Save files
}}
>
// Drag'n'drop content
</label>
<input
type="file"
style={{ display: 'none' }}
onChange={(event) => {
const files = event.target.files
// Save files
}}
/>
</div>
)
} |
Beta Was this translation helpful? Give feedback.
I solved with: