-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1 lines (1 loc) · 1.01 KB
/
index.html
1
<!DOCTYPE html><html><head><title>vinbin</title><meta charset="utf-8"><meta name="author" content="https://twitter.com/vincentmcasey"></head><body><div id="ct"><h1>DataURL Gen</h1><h2>Drop file:</h2><div id="dC" style="height:99px;"></div><h3>Select file:</h3><input type="file" id="fIn"><br><button onclick="genURL()">Generate</button><h2>Output:</h2><p id="d"></p></div><script>function genURL(){const file=fIn.files[0];if(file){const reader=new FileReader();reader.onload=function(evt){d.innerHTML=`<a href="${evt.target.result}">${evt.target.result}</a>`;};reader.readAsDataURL(file);}}dC.addEventListener('dragover',function(evt){evt.preventDefault();});dC.addEventListener('drop',function(evt){fIn.files=evt.dataTransfer.files;evt.preventDefault();});</script><style>#ct{font:12px/1.4 "Helvetica Neue", Arial, Helvetica, sans-serif;margin:0 auto;margin-top:2rem;width:20rem;padding:20px;inline-size:15remx;overflow-wrap:break-word;}div,#dC{border:1px solid black;-webkit-border-radius:5px;border-radius:5px;}</style></html>