//获取上传图片路径1 function fileComment(obj){ /*获取input=file图片路径*/ var objUrl = getObjectURL(obj.files[0]); if (objUrl) { return objUrl; } } //获取上传图片路径2 function getObjectURL(file) { var url = null; if (window.createObjectURL != undefined) { // basic url = window.createObjectURL(file); } else if (window.URL != undefined) { // mozilla(firefox) url = window.URL.createObjectURL(file); } else if (window.webkitURL != undefined) { // webkit or chrome url = window.webkitURL.createObjectURL(file); } return url; }
时间: 2024-10-14 20:51:14