Javascript 将图像链接拖放到文本区域并提取源
我想将另一个浏览器中的图像拖到我网站的文本区域,然后提取图像源。但所选的var\u文件未定义 html:Javascript 将图像链接拖放到文本区域并提取源,javascript,file-upload,drag-and-drop,base64,Javascript,File Upload,Drag And Drop,Base64,我想将另一个浏览器中的图像拖到我网站的文本区域,然后提取图像源。但所选的var\u文件未定义 html: 我建议您首先将图像下载到本地计算机中,然后将图像拖到您的网站中。也许这会有帮助 <textarea id="input" type="file" rows="4" cols="50"> </textarea> document.getElementById("input").addEventListener('drop', function ( e ){
我建议您首先将图像下载到本地计算机中,然后将图像拖到您的网站中。也许这会有帮助
<textarea id="input" type="file" rows="4" cols="50"> </textarea>
document.getElementById("input").addEventListener('drop', function ( e ){
e.stopPropagation();
e.preventDefault();
var selected_file = e.dataTransfer.files[0];
console.log(selected_file);
});