Function description: You need to preview the image before uploading it
Dashenmen, please give me some advice on how to implement it. I have been working on it for several days
function previewImage(element) { var src; element.select(); src = document.selection.createRange().text; document.getElementById('preview').innerHTML = '<img src="'+ src +'" />'; }<input type="file" name="pic" id="pic" onchange="previewImage(this)" /> <div id="preview"></div>
This method is fine when running locally, but not when running on the server
Upload preview plug-in
Upload preview plug-in