<div class="mms_uploadIconBox" >
<input class="mms_add_imgBox" style="opacity: 0;" type="file" id="file1" name="file" accept="image/*"/> <div class="mms_uploadIcon"><img id="picture1" src="images/add.png"></div> </div>
function getPhoto(node){
var file = node.files[0],
reader = new FileReader();
reader.readAsDataURL(file);
var file_size = file.size/1024;
console.log(file_size);
if(file.file_size>3000){
layer.msg('文件过大,请重新上传'); return false } reader.onload = function(e){ // for(var i=0;i<e.target.result.length;i++){ // imgdata+=e.target.result.charCodeAt(i).toString(16); // } $("#picture1").attr("src",e.target.result); console.log(e.target.result); }; }