Ajax_iframe文件上传
Ajax_iframe文件上传 2015-02-01 12:00 js 无法实现 文件的上传几种伪装 iframe伪装,jquery.uploaded-file swf插件 html5 前两种只是一种模拟无刷新的效果 第一种:Iframe实现文件上传 IframeFileUp.php: <?php if ( empty ( $_FILES )){ exit ( 'no file' ); } $error = $_FILES [ 'pic' ][ 'error' ] == 0 ? ' 文件上传成功 ' : ' 文件上传失败 ' ; // 上传成功 echo "<script>parent.document.getElementsByTagName('h2')[0].innerHTML = ' $error '</script>" ; ?> IframeFileUp.html: <html> <head> <title> iframe 文件上传 </title> <script type = "text/javascript" src = "./jquery.min.js" ></script> <script type = "text/javascript" > /* 分析: 1. 捕捉表单提交的动作 2. 创建一个 iframe 3 。把表单的 target 指向该 iframe