$(function(){var str='<a class=\'magic-upload\'><input accept=\'image/gif,image/jpg,image/jpeg,image/png,image/GIF,image/JPG,image/JPEG,image/PNG\' type=\'file\' name=\''+MagicUploadName+'\'><font>+</font><img class=magic-upload-img></a>';$("#ShowMagicUpload").html(str);$(".magic-upload").on("change","input[type='file']",function(){var filePath=$(this).val();if(filePath.indexOf("jpg")!=-1||filePath.indexOf("png")!=-1||filePath.indexOf("gif")!=-1||filePath.indexOf("bmp")!=-1){$(".magic-upload font").html("");$(".magic-upload-img").show();$(".magic-upload-img").attr("src",URL.createObjectURL($(this)[0].files[0]))}else{alert("您没有选择图片，请重新选择需要上传的图片！");$(".magic-upload font").html('+');$(".magic-upload-img").hide();return false}})});