Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将图像链接拖放到文本区域并提取源_Javascript_File Upload_Drag And Drop_Base64 - Fatal编程技术网

Javascript 将图像链接拖放到文本区域并提取源

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 ){

我想将另一个浏览器中的图像拖到我网站的文本区域,然后提取图像源。但所选的var\u文件未定义

html:


我建议您首先将图像下载到本地计算机中,然后将图像拖到您的网站中。也许这会有帮助

 <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);
});