教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 php iframe无刷新上传文件的实现代码

php iframe无刷新上传文件的实现代码

发布时间:2015-11-19   编辑:jiaochengji.com
无需刷新页面即可实现文件的上传,正在研究这块的朋友,可以作个参考。

有关iframe的内容,可以参考:html的iframe标签对象详解。
代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<meta http-equiv="Content-Language" content="zh-cn" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="robots" content="all" />
<title>Iframe无刷新上传</title>
<link rel="stylesheet" type="text/css" href="template/style.css" />
</head>
<body onload='iframe1.window.location="show_image.php"'>
<div id="header">AJAX无刷新上传演示</div>
<div id="des">
只允许上传格式为jpg,gif,png的图片,大小不超过1000K,上传后的图片会放在临时文件夹<br />
浏览器必须支持JavaScript和没有屏蔽Iframe,不然将看不到效果
</div>
<div id="mainform">
<form action="upload.php" method="post" enctype="multipart/form-data" name="upload_img" target="iframe1">
选择要上传的图片:<input type="file" name="image"><br />
<input type="submit" value="上传图片">
</form>
</div>
<div id="message" style="display:none" onclick="this.style.display='none'"></div>
<table id="maintable">
<tr>
<td colspan="2" id="title">临时文件夹中的全部图片</td>
</tr>
<tr>
<td>
<form method="post" name="delimage" action="del.php" target="iframe1">
<a href="#" onclick='javascript:document.delimage.submit();'>[删除所有图片]</a>
</form>
</td>
<td>
<form method="post" name="showimage" action="show_image.php" target="iframe1">
<a href="#" onclick="javascript:document.showimage.submit();">[刷新所有图片]</a>
</form>
</td>
</tr>
<tr>
<td colspan="2"><div id="show_image"></div></td>
</tr>
</table>
<br>
<iframe name="iframe1" width="0" height="0" scrolling="no"></iframe>
</body>
</html>
php 无刷新上传方法,更多时候是结合ajax来实现,这里给大家一个参考实例:php ajax无刷新上传图片的例子。
如果你对iframe刷新不是很了解,建议您阅读下:iframe刷新方法。

您可能感兴趣的文章:
php iframe无刷新上传文件的实现代码
php 利用iframe实现无刷新文件上传功能
jquery刷新aspx中iframe的src的代码
iframe无刷新文件上传实现程序
Juery结合iframe实现无刷新上传图片的代码
php无刷新文件上传程序代码
jsp ajax提交带文件上传的表单例子
php 无刷新上传文件的代码
js php实现无刷新下载功能
php iframe实现无刷新上传文件例子

[关闭]
~ ~