swf上传文件
发布时间:2020-12-15 18:05:05 所属栏目:百科 来源:网络整理
导读:以下是自学it网-- 中级班上课笔记 ??????????? 网址:www.zixue.it 引入的js包自己在网上找一个,这里好像不支持上传文件,反正我没找到,呵呵~~ html文件 !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml
|
以下是自学it网--中级班上课笔记 ??????????? 网址:www.zixue.it 引入的js包自己在网上找一个,这里好像不支持上传文件,反正我没找到,呵呵~~html文件 <!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>
<title>swf文件上传</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<script type="text/javascript" src="./swf/swfupload.js"></script>
<script type="text/javascript">
// 写配置,就像.ini,.conf
var setting =
{
upload_url:'upfile.php',//后后接收的地址
flash_url: './swf/Flash/swfupload.swf',// swf上传插件主文件
file_post_name: 'pic',file_types : "*.jpg;*.gif",// 限制文件类型
button_placeholder_id:'upload',// 插件初始化之后所占的对象位置
button_width:'200px',button_height:'40px',button_text:'请选择文件',upload_success_handler : function(file,data) {
if(data == 'OK') {
alert('上传成功');
}
},upload_progress_handler: function(file,complete,total) {
document.getElementById('progress').innerHTML = complete/total;
}
};
var swfu = null;
window.onload = function() {
// 页面加载完毕,就初始化swf对象
swfu = new SWFUpload(setting);
}
</script>
<style type="text/css">
</style>
</head>
<body>
<div id="progress"></div>
<div id="upload"></div>
<input type="button" value="上传" onclick="swfu.startUpload();" />
</body>
</html>
upfile.php echo move_uploaded_file($_FILES['pic']['tmp_name'],'./upload/' . $_FILES['pic']['name']) ? 'OK':'fail'; 如图:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |

