function deleteItem():void{
var selectItems:Array = process_list.selectedItems;
var selectIndex:Array = process_list.selectedIndices;
selectIndex = selectIndex.sort(2);//索引按降序排序
var iCount:int = selectItems.length;
var sizeMum:Number = 0;
for(var i:int=0;i<iCount;i++){
info.splice(selectIndex[i],1);
fileRef.fileList.splice(selectIndex[i],1);//移除的选择项按索引从大到小移除,以便移除过程中索引不超界
}
for(var j:Number=0;j<fileRef.fileList.length;j++){
sizeMum+=fileRef.fileList[j].size;
}
process_list.dataProvider = info;
tip_txt.text="共"+fileRef.fileList.length+"个文件 "+(sizeMum/(1024*1024)).toFixed(4).toString()+"MB";
if(info.length<=0){
delete_btn.enabled = false;
}
}
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
<style type="text/css教程" media="screen">
html, body { height:100%; }
body { margin:0; padding:0; overflow:auto; text-align:center;
background-color: #ffffff; }
#flashContent { display:none; }
</style>
<script type="text/网页特效" src="swfobject.js"></script>
<script type="text/javascript" >
var swfVersionStr = "10.0.0";
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
flashvars.url = "SaveFile.aspx?Param=ID|100,NAME|测试用户";
var params = {};
params.quality = "high";
params.bgcolor = "#ffffff";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "upload";
attributes.name = "upload";
attributes.align = "middle";
swfobject.embedSWF(
"upload.swf", "flashContent",
"587", "370",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
function uploadCompelete(){
//完成后的操作,如页面跳转或关闭当前页
document.getElementById('btnUpload').disabled = false;
}
function submitForm(){
thisMovie("upload").uploadfile();
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
function disabledButton()
{
document.getElementById('btnUpload').disabled = true;
}
</script>
</head>
<body>
<div id="flashContent" style="width:587px; height:380px">
</div>
<br />
<input id="btnUpload" style="width: 71px" type="button" value="上 传" onclick="submitForm()" />
</body>
</html>
如上,页面放置一个按钮,执行upload.swf里面的uploadfile方法,在flex里面其实是回调了uploadHandler方法:
//===================
// 点击上传按钮
//===================
internal function uploadHandler():void{
if(uploadFile_num!=0) return;
if(process_list.dataProvider==null || info.length<=0){
Alert.show("您还未选择文件!","提示信息");
return;
}
else
{
ExternalInterface.call("disabledButton"); //点上传后禁用按钮
}
for(var i:Number=0;i<fileRef.fileList.length;i++){
upload_size_total+=fileRef.fileList[i].size;
}
uploadfile(uploadFile_num);
add_btn.enabled = false; //点上传后禁用浏览按钮
delete_btn.enabled = false;//点上传后禁用删除按钮
}
SaveFile.aspx页面主要是接收并存储文件,如下:
protected void Page_Load(object sender, EventArgs e)
{
//string param = Request["Param"];
string path = Server.MapPath("files/");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
//HttpFileCollection files = Request.Files;
//string fileName = string.Empty;
//for (int i = 0; i < files.Count; i++)
//{
// fileName = Path.GetFileName(files[i].FileName).ToLower();
// files[i].SaveAs(path + fileName);
//}
HttpPostedFile file = Request.Files["Filedata"]; //文件是一个一个异步提交过来,所以不需要循环文件集合
if (file != null && file.ContentLength > 0)
{
file.SaveAs(path+Request.Form["filename"]);
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有