<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Hopes

    Start Here..

     

    ASP.NET中如何使用SWFUpload上傳文件

    ASP.NET中如何使用SWFUpload上傳文件

    ASP.NET中如何使用SWFUpload上傳文件來源:網絡轉摘 作者:佚名 瀏覽: 1784 次 2009-2-20 17:44:53

    前陣子有人提到這個上傳工具,小弟沒玩過就給它抓下來試試
    SWFUpload可以支援多檔上傳功能,還不錯用,小弟分享一下試用的結果

    首先要將官網的Demo Sample抓下來,如下所示:

    SWFUpload下載網址:http://swfupload.googlecode.com
    SWFUpload 下載檔案:SWFUpload-Samples v2.1.0.Release.zip

    在\SWFUpload Samples v2.1.0\demos\applicationdemo.net目錄裡有下列檔案



    接下來只要修改Default這支程式就可以了..我 只增加了儲存選取檔案的功能..

    和清除目前選取檔案的功能..更多的功能就要自己去修 改了...

    asp.net(c#)

    Default.aspx
    view plaincopy to clipboardprint?
    <%@ Page Language="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default" %>

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

    <htmlxmlns="http://www.w3.org/1999/xhtml">
    <headrunat="server">
    <title>SWFUpload Revision v2.1.0 Application Demo (ASP.Net 2.0)</title>
    <linkhref="css/default.css"rel="stylesheet"type="text/css"/>
    <scripttype="text/javascript"src="swfupload/swfupload.js"></script>
    <scripttype="text/javascript"src="js/handlers.js"></script>
    <scripttype="text/javascript">
    var swfu;
    window.onload = function () {
    swfu = new SWFUpload({
    // Backend Settings
    upload_url: "upload.aspx", // Relative to the SWF file
    post_params : {
    "ASPSESSID" : "<%=Session.SessionID %>"
    },

    // File Upload Settings
    file_size_limit : "2048", // 2MB
    file_types : "*.jpg",
    file_types_description : "JPG Images",
    file_upload_limit : "0", // Zero means unlimited

    // Event Handler Settings - these functions as defined in Handlers.js
    // The handlers are not part of SWFUpload but are part of my website and control how
    // my website reacts to the SWFUpload events.
    file_queue_error_handler : fileQueueError,
    file_dialog_complete_handler : fileDialogComplete,
    upload_progress_handler : uploadProgress,
    upload_error_handler : uploadError,
    upload_success_handler : uploadSuccess,
    upload_complete_handler : uploadComplete,

    // Flash Settings
    flash_url : "swfupload/swfupload_f9.swf", // Relative to this file

    custom_settings : {
    upload_target : "divFileProgressContainer"
    },

    // Debug Settings
    debug: false
    });
    }
    </script>
    </head>
    <body>
    <formid="form1"runat="server">
    <divid="header">
    <h1id="logo"><ahref="../">SWFUpload</a></h1>
    <divid="version">v2.1.0 Beta</div>
    </div>


    <divid="content">
    <h2>Application Demo (ASP.Net 2.0)</h2>

    <divid="swfu_container"style="margin: 0px 10px;">
    <div>
    <buttonid="btnBrowse"type="button"style="padding: 5px;"onclick="swfu.selectFiles(); this.blur();"><imgsrc="images/page_white_add.png"style="padding-right: 3px; vertical-align: bottom;"alt="Add Icon"/>Select Images <spanstyle="font-size: 7pt;">(2 MB Max)</span></button>
    <asp:ButtonID="btnSave"runat="server"OnClick="btnSave_Click"Text="Save Select Images"Width="150px"/>
    <asp:ButtonID="btnClear"runat="server"Text="Clear Select Images"OnClick="btnClear_Click"Width="150px"/></div>
    <divid="divFileProgressContainer"style="height: 75px;"></div>
    <divid="thumbnails"></div>
    </div>
    </div>
    </form>
    </body>
    </html>

    Default.aspx.cs
    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.Collections.Generic;
    using System.IO;

    public partial class _Default : System.Web.UI.Page
    {
    protectedvoid Page_Load(object sender, EventArgs e)
    {
    // Clear the user's session
    if (!IsPostBack)
    {
    Session.Clear();
    }
    }
    protectedvoid btnSave_Click(object sender, EventArgs e)
    {
    if (Session["file_info"] != null)
    {
    List<Thumbnail> thumbnails = Session["file_info"] as List<Thumbnail>;

    string UploadPath = Server.MapPath("upload/");

    foreach (Thumbnail img in thumbnails)
    {
    FileStream fs = new FileStream(UploadPath + img.ID + ".jpg", FileMode.Create);
    BinaryWriter bw = new BinaryWriter(fs);
    bw.Write(img.Data);
    bw.Close();
    fs.Close();
    }

    Session.Clear();
    }
    }
    protectedvoid btnClear_Click(object sender, EventArgs e)
    {
    Session.Clear();
    }
    }

    posted on 2012-12-04 16:40 ** 閱讀(264) 評論(0)  編輯  收藏


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     

    導航

    統計

    公告

    你好!

    常用鏈接

    留言簿(2)

    隨筆檔案

    文章分類

    文章檔案

    新聞檔案

    相冊

    收藏夾

    C#學習

    友情鏈接

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲av日韩av无码| 久久这里只有精品国产免费10| 国产在线观看免费完整版中文版| 亚洲va在线va天堂va手机| 91香蕉在线观看免费高清| 亚洲激情视频在线观看| 一级毛片全部免费播放| 亚洲经典在线中文字幕| 免费视频专区一国产盗摄| 亚洲永久网址在线观看| 日日夜夜精品免费视频| 国产AV无码专区亚洲AV琪琪| 亚洲国产av一区二区三区| 人妻仑乱A级毛片免费看| 亚洲精品美女久久777777| 91情侣在线精品国产免费| 亚洲喷奶水中文字幕电影| 成人免费a级毛片| 立即播放免费毛片一级| 国产成人亚洲综合无码| 久章草在线精品视频免费观看| 97se亚洲综合在线| 成人性生交大片免费看无遮挡| 色婷婷精品免费视频| 国产亚洲精品无码成人| 成年人网站免费视频| 亚洲AV无码成人精品区在线观看| 色播在线永久免费视频网站| 91嫩草私人成人亚洲影院| 在线视频免费观看www动漫| 免费国产污网站在线观看不要卡| 亚洲成a人片在线观看无码| aⅴ免费在线观看| 无码天堂va亚洲va在线va| 久久亚洲精品中文字幕三区| 999久久久免费精品国产 | 亚洲?V乱码久久精品蜜桃| 国产免费网站看v片在线| 亚洲中文字幕无码爆乳app| 国产福利电影一区二区三区,亚洲国模精品一区 | 好看的亚洲黄色经典|