<?php
if (!empty($_FILES)){
echo "<pre>";
echo $_FILES['file']['type'];
echo "</pre>";
return;
}
?>
<script type="text/javascript">
function autoUpLoad(){
$("#txtHint").html("<center><img src='include/images/loader.gif' />Reading selected file...</center>");
$(document).ready(function(){
$("#file").change(function(){
$("#myForm").submit(function(data){
$("#txtHint").html(data);
});
});
});
}
</script>
<form id="myForm" method="post" enctype="multipart/form-data">
<input type="file" name="file" id = "file" onchange='autoUpLoad()'/>
<input type="submit" value="Send" />
</form>
<div id="txtHint">
test
</div>
上面的代码不起作用,我不确定这里有什么问题?只有当我删除这些行时它才有效:
function(data){
$("#txtHint").html(data);
}
它只是不允许我将数据返回到txtHint
. 谁能向我解释如何使它工作?