日期:2014-05-16  浏览次数:20623 次

JQUERY > 异步(ajax)上传图片

?

    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head id="Head1" runat="server">  
        <title></title>  
		<meta charset="utf-8">
        <script src="./jquery-1.4.min.js" type="text/javascript"></script>  
        <script src="./jquery.form.js" type="text/javascript"></script>  
		
        <script type="text/javascript">  
		
            function uploadImage() {  
					$('#imgDiv').html('开始上传');
				  $('#UpLoadForm').ajaxSubmit(null,"imgDiv");
            }  
		
        </script>  
    </head>  
    <body>  
    <form  enctype="multipart/form-data" action="http://***.com/img_receive.php" method="post"  id="UpLoadForm">  
    <input type="file" id="uploadFile" runat="server" name="upfile" />  
    <input type="button" id="btnUpload" value="确定" onclick="uploadImage()" />  
    <div id="imgDiv">    </div>  
    </form>  
    </body>  
    </html>  

?

其中 jquery.form.js ?见附件

?

?