日期:2014-05-16 浏览次数:20806 次
<!doctype html>
<html>
<head>
</head>
<body>
<input type="file" name="file" id="file" />
<script type="text/javascript" src="./jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="./jquery.form.js"></script>
<script type="text/javascript">
$(function(){
$("#file").change(function(){
$(this).wrap("<form id='ajaxupload' action='./index.php' method='post' enctype='multipart/form-data'></form>");
$("#ajaxupload").ajaxSubmit({
dataType:'text',
success:function(data){
alert(data);
},
error:function(data){
}
});
$(this).unwrap();
});
});
</script>
</body>
</html>
<?php
print_r($_FILES);
?>
$(function () {
$("#file").change(function () {
$(this).wrap("<form id='ajaxupload' action='upload.php' method='post' enctype='multipart/form-data'></form>");
$("#ajaxupload").ajaxSubmit({
dataType: 'text',
success: function (data) {
alert( data ');