<input class="uploadImg" type="file" name="uploadfile2" id="file3">
<div class="fileimg3"></div>
<script type="text/javascript">
$('#file3').change(function(){
function getObjectURL(file) {
var url = null;
if (window.createObjcectURL != undefined) {
url = window.createOjcectURL(file);
} else if (window.URL != undefined) {
url = window.URL.createObjectURL(file);
} else if (window.webkitURL != undefined) {
url = window.webkitURL.createObjectURL(file);
}
return url;
}
var objURL = getObjectURL(this.files[0]);//这里的objURL就是input file的真实路径
$('.fileimg3').html("<img src='" + objURL + "' alt='Alternate Text' width='640px' height='350px' id='target' />");
});
</script>