multipart/form-data请求与文件上传的细节


<!DOCTYPE html>
<html>
<head lang="en">
 <meta charset="UTF-8">
 <title></title>
 <script src="js/jquery.min.js"></script>
</head>
<body>
<form id= "uploadForm" action= "http://192.168.12.50:8080/file/upload" method= "post" enctype ="multipart/form-data">
<!--<p >指定文件名: <input type ="text" name="filename" /></p>-->
<p >上传文件: <input type ="file" name="file" /></p>
<p >关键字1: <input type ="text" name="areaCode" /></p>
<p >关键字1: <input type ="text" name="sessionId" /></p>
<input type ="submit" value="上传"/>
</form>
</body>
</html>
<script>
var dataReq={areaCode:"globalservice",file:"u=384764150,406696308&fm=27&gp=0.jpg",sessionId:"FF4F1F829F43D6E59AF3A1E67CA6B8B9"};
$.ajax({
url : "http://192.168.12.50:8080/file/upload",
type : "POST",
data : dataReq,
success : function(data) {
$( '#serverResponse').html(data);
},
error : function(data) {
$( '#serverResponse').html(data.status + " : " + data.statusText + " : " + data.responseText);
}
});
</script>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM