天天看點

flash 大檔案上傳

最近在做大檔案上傳項目時碰到了很多問題。基于.net的大檔案上傳元件網上是大把的有。

但這些元件基本上都是基于HttpModule模式的,大部分都存在一個緻命的問題:嚴重消耗記憶體。

最後沒辦法,隻好采用Flash的FileReference模式去上傳。具體我也不是很明白,大家可自己研究。

展開下面的代碼看吧,第一次使用代碼模式,有點問題

一、CS相應源碼如下:

import flash.net.FileReference;

import flash.net.URLRequest;

import flash.net.FileFilter;

import flash.display.Sprite;

import flash.events.*;

var fileRef = new FileReference();

var fileListener = new Object();

var totalBytes:Number = 0;

var uploadedBytes:Number = 0;

//從外部擷取也許上傳的檔案類型

var acceptFileType:String = getFlashVars("acceptFileType");

//設定上傳完畢後執行的js腳本

var comJsFun:String=getFlashVars("ComJsFun");

//this.tbFilePath.text = comJsFun;

//

var uploadURL:URLRequest = new URLRequest();

var xmlRequest:URLRequest = new URLRequest();

var xmlLoader:URLLoader = new URLLoader();

//初始化系統

function init() {

this.mcWaterStyle.visible = false;

this.mcFilePlayer.visible = false;

this.progressBar.visible = false;

//設定按鈕文字大小,預設的字型和大小有點難看。

var myFormat = new TextFormat();

myFormat.size = 12;

this.btBrowser.setStyle("textFormat", myFormat);

this.btUpload.setStyle("textFormat", myFormat);

this.tbFilePath.setStyle("textFormat", myFormat);

this.mcWaterStyle.style0.setStyle("textFormat", myFormat);

this.mcWaterStyle.style1.setStyle("textFormat", myFormat);

this.mcWaterStyle.style2.setStyle("textFormat", myFormat);

this.uploadInfo.setStyle("textFormat", myFormat);

//如果從FlashVars擷取的參數acceptFileType(限定上傳檔案類型)無值,那麼通路相應的XML(上傳檔案類型配置)

if(acceptFileType==""){

//從外部擷取上傳附加的檔案類型。

xmlRequest = new URLRequest("http://www.cnblogs.com/XML/Setting_Article.xml");

xmlLoader.load(xmlRequest);

xmlLoader.addEventListener(Event.COMPLETE,loaderHandler);

}

init();

//按鈕事件

this.btBrowser.addEventListener(MouseEvent.CLICK, browseHandler);

this.btUpload.addEventListener(MouseEvent.CLICK, UploadHandler);

fileRef.addEventListener(Event.SELECT,selectHandler);//選擇檔案

fileRef.addEventListener(Event.CANCEL, cancelHandler);//上傳過程中取消事件

fileRef.addEventListener(Event.OPEN, openHandler);//開始上傳事件

fileRef.addEventListener(Event.COMPLETE, completeHandler);//上傳完畢事件

fileRef.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA,uploadCompleteDataHandler)//上傳資料完畢事件,有點迷惑Event.COMPLETE跟DataEvent.UPLOAD_COMPLETE_DATA的差別

fileRef.addEventListener(ProgressEvent.PROGRESS, progressHandler);//上傳過程事件,相應的進度條代碼在這裡了

//監聽上傳過程可能出錯的事件

fileRef.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);

fileRef.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);

fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);

//浏覽按鈕事件

function browseHandler(event:MouseEvent):void {

fileRef.browse(browseGetTypes());

function browseGetTypes():Array {

var allTypes:Array = new Array(browseGetFileTypeFilter());

return allTypes;

function browseGetFileTypeFilter():FileFilter {

if(acceptFileType!=""){

var arr = acceptFileType.split("|");

var FileExtension = "";

for(var i=0;i<arr.length;i++){

if (arr == "")

continue;

if(i==0)

FileExtension = "*."+arr;

else

FileExtension = FileExtension+";*."+arr;

return new FileFilter("檔案格式("+FileExtension+")", ""+FileExtension+"");

}else{

return new FileFilter("所有檔案(*.*)","*.*");

//return new FileFilter("所有檔案(*.*)","*.*");

//加載上傳配置事件

function loaderHandler(event:Event):void {

var myXML:XML = new XML(xmlLoader.data);

//myXML = XML();

acceptFileType = myXML.child("Upload").ContontFileStyle;

trace("--"+myXML.child("Upload").ContontFileStyle+"--");

if(this.uploadInfo.text=="")

this.uploadInfo.text = "允許的格式:"+myXML.child("Upload").ContontFileStyle;

//選擇檔案事件

function selectHandler(event:Event):void{

this.uploadInfo.text = "";

if (fileRef.size > 0){

totalBytes = fileRef.size;

this.tbFilePath.text = fileRef.name+ "[" + this.getSizeType(totalBytes) + "]";

var fileExtName = fileRef.name.substring(fileRef.name.lastIndexOf(".")+1);

switch(fileExtName.toLowerCase()){

case "jpg":

case "jpeg":

case "gif":

case "bmp":

this.mcWaterStyle.visible = true;

break;

case "flv":

this.mcFilePlayer.visible = true;

this.mcFilePlayer.mcWidth.text = 410;

this.mcFilePlayer.mcHeight.text = 370;

case "swf":

this.mcFilePlayer.mcWidth.text = 550;

this.mcFilePlayer.mcHeight.text = 400;

case "rm":

case "rmvb":

case "mp3":

case "avi":

case "mpg":

case "mpeg":

case "asf":

case "wmv":

case "wma":

default:

this.uploadInfo.text = "錯誤:您沒有選擇檔案!";

//上傳過程中取消

function cancelHandler(event:Event):void{

};

//當上載或下載下傳操作開始時

function openHandler(event:Event):void{

this.tbFilePath.visible = false;

this.btBrowser.visible = false;

this.btUpload.label = "取消";

this.progressBar.visible = true;

//點選傷

function UploadHandler(event:MouseEvent):void{

if (this.btUpload.label=="上傳"){

var WaterMarkStyleP:String = "";

if(this.mcWaterStyle.style0.selected == true)

WaterMarkStyleP = "0";

else if(this.mcWaterStyle.style1.selected == true)

WaterMarkStyleP = "1";

else if(this.mcWaterStyle.style2.selected == true)

WaterMarkStyleP = "2";

var mcFilePlayerP:String="&width="+this.mcFilePlayer.mcWidth;

mcFilePlayerP += "&height="+this.mcFilePlayer.mcHeigth;

if(this.mcFilePlayer.mcAutoYes.selected == true)

mcFilePlayerP += "&auto=true";

else if(this.mcFilePlayer.mcAutoNo.selected == true)

mcFilePlayerP += "&auto=false";

uploadURL.url="Upload_File_SWF.aspx?WaterMarkStyle="+WaterMarkStyleP+mcFilePlayerP;

fileRef.upload(uploadURL);//此為采用aspx預設方式進行上傳的檔案位址。如:Upload_File_SWF.aspx此頁面我在上傳完畢後,直接進行Response.Write("true");那麼Flash可在uploadCompleteDataHandler後可後去到true這個資料。以便你進行操作。

}else if(this.btUpload.label=="取消"){

this.tbFilePath.visible = true;

this.btBrowser.visible = true;

this.btUpload.label = "上傳";

this.uploadInfo.text="";

}else if(this.btUpload.label=="重新上傳"){

//在檔案上載或下載下傳操作期間定期調用

function progressHandler(event:ProgressEvent):void{

//var fileRef:FileReference = FileReference(event.target);

if(event.bytesLoaded==event.bytesTotal){

this.uploadInfo.text= "正在轉移資料,請稍後--"+getSizeType(event.bytesLoaded)+"/"+getSizeType(event.bytesTotal);

this.progressBar.mcMask.width = (event.bytesLoaded/event.bytesTotal)*this.progressBar.mcLoaded.width;

this.uploadInfo.text="上傳檔案中,請等待--"+getSizeType(event.bytesLoaded)+"/"+getSizeType(event.bytesTotal);

function completeHandler(event:Event):void {

//trace("completeHandler: " + event);

this.tbFilePath.text = "";

//this.uploadInfo.text = "上傳成功!";

function uploadCompleteDataHandler(event:DataEvent):void {

if(event.data.indexOf("|")!=-1){

var fileInfoArr = event.data.split("|");

if(fileInfoArr[0].toLowerCase()=="true"){

this.uploadInfo.text = "上傳成功:"+fileInfoArr[1]+"!";

if(comJsFun!=""){

//ExternalInterface.call("UploadForEditor","hh");

ExternalInterface.call("UploadForEditor",event.data.replace("true|",""));

//this.tbFilePath.text = event.data;

this.uploadInfo.text = "上傳失敗:"+EncodeUtf8(fileInfoArr[1])+"!";

trace("uploadCompleteData: " + event.data);

//錯誤事件

function httpStatusHandler(event:HTTPStatusEvent):void {

trace("httpStatusHandler: " + event);

this.uploadInfo.text="HTTP錯誤: " + event;

function ioErrorHandler(event:IOErrorEvent):void {

trace("ioErrorHandler: " + event);

this.uploadInfo.text="IO錯誤: " + event;

function securityErrorHandler(event:SecurityErrorEvent):void {

trace("openHandler: " + event);

this.uploadInfo.text="IO安全設定錯誤: " + event;

/**//*--------------------以下為常用函數-------------

---------------------------------------------*/

//處理檔案大小表示方法

function getSizeType(s)

{

var danwei = ["Byte","KB","MB","GB" ];

var d = 0;

while ( s >= 900 )

s = Math.round(s*100/1024)/100;

d++;

return s+danwei[d];

function getFlashVars(parName){

var parValue:String=stage.loaderInfo.parameters[parName];

if(parValue==null)

return "";

return parValue;

//轉換亂碼

function EncodeUtf8(str : String):String {

var oriByteArr : ByteArray = new ByteArray();

oriByteArr.writeUTFBytes(str);

var tempByteArr : ByteArray = new ByteArray();

for (var i = 0; i<oriByteArr.length; i++) {

if (oriByteArr == 194) {

tempByteArr.writeByte(oriByteArr[i+1]);

i++;

} else if (oriByteArr == 195) {

tempByteArr.writeByte(oriByteArr[i+1] + 64);

} else {

tempByteArr.writeByte(oriByteArr);

tempByteArr.position = 0;

return tempByteArr.readMultiByte(tempByteArr.bytesAvailable,"chinese");

//return tempByteArr.readMultiByte(tempByteArr.bytesAvailable,"chinese");

複制代碼

二、相應的上傳檔案代碼(.net)

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.IO;

using System.Drawing;

using System.Drawing.Imaging;

namespace TT.WebManager.Web.Admin.Article

public partial class Upload_File_SWF : System.Web.UI.Page

string AppPath = "";

string FileURL = "";//檔案網絡位址

string FileURL2 = "";//檔案網絡位址,如果加了水印

string FileAppPath = "";

string FileAppPath2 = "";

string sFilePathName = "";

string sFileName = "";

int FileSize = 0;

string FileExtName = "";

int WaterMarkStyle = 0;

string FileAuto = "true";

int FileWidth = 0;

int FileHeigth = 0;

protected void Page_Load(object sender, EventArgs e)

TT.WebManager.BLL.Setting bll = new TT.WebManager.BLL.Setting();

bll.Init(false);

AppPath = System.Web.HttpContext.Current.Request.PhysicalApplicationPath;

WaterMarkStyle = Methods.Req.GetInt("WaterMarkStyle", 0);

FileWidth = Methods.Req.GetInt("Width",550);

FileHeigth = Methods.Req.GetInt("Heigth", 400);

FileAuto = Methods.Req.GetString("Auto");

try

HttpPostedFile postedFile = Request.Files["Filedata"];

sFilePathName = postedFile.FileName;

FileSize = postedFile.ContentLength; //===========擷取檔案的大小

if (FileSize <= 0)

Response.Clear();

Response.Write("false|您沒有選擇檔案!");

Response.End();

sFileName = sFilePathName.Substring(sFilePathName.LastIndexOf("\\") + 1);

FileExtName = sFilePathName.Substring(sFilePathName.LastIndexOf(".") + 1);

if (IsValidFileType(FileExtName) == false)

Response.Write("false|系統禁止上傳此格式的檔案!");

GotoUploadFile(postedFile);

catch { }

protected void GotoUploadFile(HttpPostedFile postedFile)

string NewFileName = DateTime.Now.ToString("yyyyMMddhhmmss") + FileSize + "." + FileExtName;

string NewFileName2 = DateTime.Now.ToString("yyyyMMddhhmmss") + FileSize + "_1." + FileExtName;

string NewFilePath = "";

if (Model.Article.Setting.Upload_SortFile == true)

if (Model.Article.Setting.Upload_FolderStyle != "")

FileURL = Model.Article.Setting.Upload_Prefix + Model.Article.Setting.Upload_Folder + "/" + FileExtName + "/" + DateTime.Now.ToString(Model.Article.Setting.Upload_FolderStyle) + "/" + NewFileName;

FileURL2 = Model.Article.Setting.Upload_Prefix + Model.Article.Setting.Upload_Folder + "/" + FileExtName + "/" + DateTime.Now.ToString(Model.Article.Setting.Upload_FolderStyle) + "/" + NewFileName2;

NewFilePath = AppPath + Model.Article.Setting.Upload_Folder.Replace("/", "\\") + "\\" + FileExtName + "\\" + DateTime.Now.ToString(Model.Article.Setting.Upload_FolderStyle).Replace("/", "\\");

FileURL = Model.Article.Setting.Upload_Prefix + Model.Article.Setting.Upload_Folder + "/" + FileExtName + "/" + NewFileName;

FileURL2 = Model.Article.Setting.Upload_Prefix + Model.Article.Setting.Upload_Folder + "/" + FileExtName + "/" + NewFileName2;

NewFilePath = AppPath + Model.Article.Setting.Upload_Folder.Replace("/", "\\") + "\\" + FileExtName;

FileURL = Model.Article.Setting.Upload_Prefix + Model.Article.Setting.Upload_Folder + "/" + DateTime.Now.ToString(Model.Article.Setting.Upload_FolderStyle) + "/" + NewFileName;

FileURL2 = Model.Article.Setting.Upload_Prefix + Model.Article.Setting.Upload_Folder + "/" + DateTime.Now.ToString(Model.Article.Setting.Upload_FolderStyle) + "/" + NewFileName2;

NewFilePath = AppPath + Model.Article.Setting.Upload_Folder.Replace("/", "\\") + "\\" + DateTime.Now.ToString(Model.Article.Setting.Upload_FolderStyle).Replace("/", "\\");

FileURL = Model.Article.Setting.Upload_Prefix + Model.Article.Setting.Upload_Folder + "/" + NewFileName;

FileURL2 = Model.Article.Setting.Upload_Prefix + Model.Article.Setting.Upload_Folder + "/" + NewFileName2;

NewFilePath = AppPath + Model.Article.Setting.Upload_Folder.Replace("/", "\\");

TT.WebManager.Methods.IIOO.CreateDirectory(NewFilePath);

FileAppPath = NewFilePath + "\\" + NewFileName;

FileAppPath2 = NewFilePath + "\\" + NewFileName2;

postedFile.SaveAs(FileAppPath);

switch (FileExtName.ToLower())

case "png":

//==========生成水印=============

switch (WaterMarkStyle)

case 1:

CreateWeaterText(FileAppPath, FileAppPath2, Model.Article.Setting.WaterMark_Text, FileExtName);

FileURL = FileURL2;

case 2:

CreateWeaterPicture(FileAppPath, FileAppPath2, Server.MapPath(Model.Article.Setting.WaterMark_Picture), FileExtName);

string ReturnString = sFileName + "|" + FileURL + "|" + FileWidth + "|" + FileHeigth + "|" + FileAuto;

Response.Write("true|"+ReturnString);

private void CreateWeaterText(string paraOldFileName, string paraNewsFileName, string AddText, string FileExtensionName)

System.Drawing.Image image = System.Drawing.Image.FromFile(paraOldFileName);

System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image);

//文字抗鋸齒

g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;

g.DrawImage(image, 0, 0, image.Width, image.Height);

//Font font = new Font("黑體", 14, FontStyle.Bold);

//Brush b = new SolidBrush(Color.Yellow);

Font font = new Font(Model.Article.Setting.WaterMark_FontFamily, Model.Article.Setting.WaterMark_FontSize, FontStyle.Bold);

Brush b = new SolidBrush(Methods.TypeParse.StrToColor(Model.Article.Setting.WaterMark_FontColor));

int Xpos = 0;

int Ypos = 0;

SizeF crsize = new SizeF();

crsize = g.MeasureString(AddText, font);

int crsize_With = Convert.ToInt32(crsize.Width);

int crsize_Height = Convert.ToInt32(crsize.Height);

int WaterMark_xPos = 10;

int WaterMark_yPos = 10;

switch (Model.Article.Setting.WaterMark_Position)//==========從圖檔的左上角開始算起(0,0)

Xpos = WaterMark_xPos;

Ypos = WaterMark_yPos;

Xpos = image.Width - (crsize_With + WaterMark_xPos);

case 3:

Ypos = image.Height - (crsize_Height + WaterMark_yPos);

case 4:

//畫陰影

PointF pt = new PointF(0, 0);

System.Drawing.Brush TransparentBrush0 = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(50, System.Drawing.Color.Black));

System.Drawing.Brush TransparentBrush1 = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(20, System.Drawing.Color.Black));

g.DrawString(AddText, font, TransparentBrush0, Xpos, Ypos + 1);

g.DrawString(AddText, font, TransparentBrush0, Xpos + 1, Ypos);

g.DrawString(AddText, font, TransparentBrush1, Xpos + 1, Ypos + 1);

g.DrawString(AddText, font, TransparentBrush1, Xpos, Ypos + 2);

g.DrawString(AddText, font, TransparentBrush1, Xpos + 2, Ypos);

TransparentBrush0.Dispose();

TransparentBrush1.Dispose();

g.DrawString(AddText, font, b, Xpos, Ypos);

switch (FileExtensionName.ToLower())

image.Save(System.Web.HttpContext.Current.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);

image.Save(System.Web.HttpContext.Current.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);

image.Save(System.Web.HttpContext.Current.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Bmp);

image.Save(System.Web.HttpContext.Current.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);

g.Dispose();

image.Save(paraNewsFileName);

image.Dispose();

if (File.Exists(paraOldFileName) == true)

File.Delete(paraOldFileName);

private void CreateWeaterPicture(string paraOldFileName, string paraNewsFileName, string AddPicture, string FileExtensionName)

System.Drawing.Image copyImage = System.Drawing.Image.FromFile(AddPicture);

ImageAttributes imageAttributes = new ImageAttributes();

ColorMap colorMap = new ColorMap();

colorMap.OldColor = Color.FromArgb(200, 0, 200, 0);

colorMap.NewColor = Color.FromArgb(0, 0, 0, 0);

ColorMap[] remapTable = { colorMap };

imageAttributes.SetRemapTable(remapTable, ColorAdjustType.Bitmap);

float[][] colorMatrixElements = {

new float[] {1.0f, 0.0f, 0.0f, 0.0f, 0.0f},

new float[] {0.0f, 1.0f, 0.0f, 0.0f, 0.0f},

new float[] {0.0f, 0.0f, 1.0f, 0.0f, 0.0f},

new float[] {0.0f, 0.0f, 0.0f, Model.Article.Setting.WaterMark_Transparency, 0.0f},

new float[] {0.0f, 0.0f, 0.0f, 0.0f, 1.0f}

ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements);

imageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);

Graphics g = Graphics.FromImage(image);

//PointF pt = new PointF(0, 0);

//System.Drawing.Brush TransparentBrush0 = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(50, System.Drawing.Color.));

//System.Drawing.Brush TransparentBrush1 = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(20, System.Drawing.Color.Black));

//g.DrawString(AddText, font, TransparentBrush0, pt.X, pt.Y + 1);

//g.DrawString(AddText, font, TransparentBrush0, pt.X + 1, pt.Y);

//g.DrawString(AddText, font, TransparentBrush1, pt.X + 1, pt.Y + 1);

//g.DrawString(AddText, font, TransparentBrush1, pt.X, pt.Y + 2);

//g.DrawString(AddText, font, TransparentBrush1, pt.X + 2, pt.Y);

//TransparentBrush0.Dispose();

//TransparentBrush1.Dispose();

//設定合成圖像的品質

//設定高品質插值法

g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;

//設定高品質,低速度呈現平滑程度

int xPos = image.Width - copyImage.Width - 10;

int yPos = image.Height - copyImage.Height - 10;

xPos = 10;

yPos = 10;

xPos = image.Width - copyImage.Width - 10;

yPos = image.Height - copyImage.Height - 10;

g.DrawImage(copyImage, new Rectangle(xPos, yPos, copyImage.Width, copyImage.Height), 0, 0, copyImage.Width, copyImage.Height, GraphicsUnit.Pixel, imageAttributes);

imageAttributes.Dispose();

// return paraNewsFileName;

protected bool IsValidFileType(string ExtName)

if (Model.Article.Setting.Upload_ContontFileStyle.Trim() == "")

return true;

string[] AcceptedFileTypes = Model.Article.Setting.Upload_ContontFileStyle.Split(new char[] { '|' });

for (int i = 0; i < AcceptedFileTypes.Length; i++)

if (ExtName.ToLower() == AcceptedFileTypes.ToLower())

return false;

三、相應的aspx頁面代碼

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>

<title>FLASH 上傳測試</title>

<meta http-equiv="content-type" content="text/html; charset=gb2312" />

<link href="../images/style.css" rel="stylesheet" type="text/css" />

<script language="javascript">AC_FL_RunContent = 0;</script>

<script src="../javascript/AC_RunActiveContent.js" language="javascript"></script>

</head>

<body>

<!--影片中使用的 URL-->

<!--影片中使用的文本-->

<!-- saved from url=(0013)about:internet -->

<script language="javascript">

if (AC_FL_RunContent == 0) {

alert("此頁需要 AC_RunActiveContent.js");

AC_FL_RunContent(

'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',

'width', '400',

'height', '56',

'src', '../SWFUpload/SWFFileUpload',

'quality', 'high',

'pluginspage', 'http://www.macromedia.com/go/getflashplayer',

'align', 'middle',

'play', 'true',

'loop', 'true',

'scale', 'showall',

'wmode', 'window',

'devicefont', 'false',

'id', 'SWFFileUpload',

'bgcolor', '#ffffff',

'name', 'SWFFileUpload',

'menu', 'true',

'allowFullScreen', 'false',

'allowScriptAccess','sameDomain',

'movie', '../SWFUpload/SWFFileUpload',

'salign', '',

'FlashVars','ComJsFun=UploadForEditor'

); //end AC code

//src和movie屬性為Flash檔案位址,請勿寫.swf字尾名

//FlashVars為給Flash設定的參數。

</script>

<noscript>

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="400" height="56" id="SWFFileUpload" align="middle">

<param name="allowScriptAccess" value="sameDomain" />

<param name="allowFullScreen" value="false" />

<param name="movie" value="../SWFUpload/SWFFileUpload.swf" />

<param name="quality" value="high" />

<param name="bgcolor" value="#ffffff" />

<param name="FlashVars" value="ComJsFun=UploadForEditor"/>

<embed src="../SWFUpload/SWFFileUpload.swf" quality="high" bgcolor="#ffffff" width="400" height="56" name="SWFFileUpload" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

</object>

</noscript>

<div id="showInfo"></div>

<script language="javascript" type="text/javascript">

function UploadForEditor(Value){

alert(Value);

//var RSArr = Value.split("|");

//UploaFile(RSArr[0],RSArr[1],RSArr[2],RSArr[3],RSArr[4]);

</body>

</html>

源碼下載下傳:附件: SWFFileUpload.rar (下載下傳 746 次)

繼續閱讀