I am making a site where you can convert your file to a data URL. Here is my current code where you select the file:
function convertToDataURL() {
alert("convert to data url");
}
.dropzone {
border: 1px solid lightgray;
padding: 2rem;
margin: 2rem;
border-radius: 10px;
font-family: Arial;
font-size: 0.8rem;
cursor: pointer;
text-align: center;
}
<input id="fileInput" type="file" style="display: none" onchange="convertToDataURL()" />
<label for="fileInput">
<div class="dropzone">Select or drop a file here</div>
</label>
The JavaScript works just fine, which is why I left it out. If I click the file input and select a file, the conversion successfully works. But if I drag a file to the file input, the input doesn't register the file, and the file just opens in a new tab. What is the cause of this, and how can I fix it?