<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> 跨域demo</title >
<script type="text/javascript" language= "javascript" src="../js/jquery-1.8.3.min.js" ></script>
</head>
<body>
<form id= "proxy_form" action ="http://wo.test.com/proxy.php" method="post" target="proxy_hidden_iframe_1">
<input type="file" name="file" value="" />
<input type="text" name="name" value="" />
<input type="button" id="proxy_btn" value="提交" />
</form>
<iframe name="proxy_hidden_iframe_1" src="about:blank" style="display :none"></iframe >
<script type="text/javascript" >
$(document).ready(function (){
$( "#proxy_btn").click(function (){
/**
* 自己编写判断数据的合法性
*/
$( "#proxy_form").submit();
});
});
/**
* 跨域回调函数
*/
function _proxyCallBack(data){
// firefox 输出结果
console.log(data);
// 再处理前台界面问题
}
</script>
</body>
</html>
<?php
/**
* 逻辑层, 域名:wo.test.com
*/
$file = $_FILES['file'];
$name = trim($_POST['name']);
// 开始处理逻辑
//$result = array("status"=>
利用iframe实现图片跨域上传
最新推荐文章于 2022-10-21 11:43:41 发布