国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

asp.net使用jQuery Uploadify上傳附件示例

2024-07-10 13:20:42
字體:
來源:轉載
供稿:網友

Uploadify是JQuery的一個上傳插件,實現的效果非常不錯,帶進度顯示。Uploadify官方網址:,在MVC中使用的方法可以參考 jQuery Uploadify在ASP.NET MVC3中的使用 和 Asp.net Mvc中使用uploadify實現圖片縮放保存。

本文是一個簡單的介紹Demo,主要是動態傳遞參數方法:通過formdata 向處理程序傳遞額外的表單數據:

復制代碼 代碼如下:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="uploadify/uploadify.css" type="text/css" />
    <script type="text/javascript" src="uploadify/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="uploadify/swfobject.js"></script>
    <script type="text/javascript" src="uploadify/jquery.uploadify.min.js"></script>
    <script type="text/javascript">

        $(function () {
            var taskId = "<%= TaskID %>";
            var activityId = "<%= ActivityId %>";
            var userId = "<%= GetCurrentLoginUser().ID %>";

            $("#<%=FileUpload1.ClientID %>").uploadify(
            {
                'swf': 'uploadify/uploadify.swf',
                'uploader': 'UploadHandler.aspx',
                'auto': false,
                'method': 'post',
                'multi': true,
                'buttonText': '瀏覽',
                'buttonImg': 'uploadify/browse.jpg',
                'folder': '../uploadfile',
                'fileDesc': '附件',
                'onUploadStart': function (event, data) { //this is where you will send the form //data, but remember to get if from post in the .ashx file, by contex.Request["gallaryId"]
                    $("#<%=FileUpload1.ClientID %>").uploadify('settings', 'formData',
                          { 'taskId': taskId, 'activityId': activityId, 'userId': userId, 'secInfo': $("#<%=ddlsecInfo.ClientID %>").val()}  //note hiddenGallaryId would //have the gallaryId which im sending through post , make sure it is rendered in your page( //i.e.not concealed by a multiview control e.t.c)
             );
                }

            });
        });
    </script>
</head>
<body>
    <form runat="server">
    <asp:FileUpload runat="server" />
    <asp:DropDownList runat="server">
        <asp:ListItem Text="公開" Value="1"> </asp:ListItem>
        <asp:ListItem Text="普通" Value="2"> </asp:ListItem>
        <asp:ListItem Text="機密" Value="3"> </asp:ListItem>
    </asp:DropDownList>
    <a href="javascript: $('#<%=FileUpload1.ClientID %>').uploadify('upload','*')">上傳</a>
    <a href="javascript:$('#<%=FileUpload1.ClientID %>').uploadify('cancel','*')">取消上傳</a>
    </form>
</body>
</html>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 启东市| 印江| 洛浦县| 巨鹿县| 栖霞市| 天水市| 海南省| 津市市| 富源县| 西城区| 大石桥市| 衡水市| 新巴尔虎左旗| 都兰县| 三都| 武冈市| 南充市| 沁水县| 石嘴山市| 肇庆市| 台中市| 招远市| 大方县| 迁安市| 木兰县| 北票市| 大同县| 奎屯市| 保定市| 阆中市| 松潘县| 东辽县| 共和县| 苍溪县| 禹城市| 吴旗县| 涿鹿县| 长治县| 临泽县| 九龙县| 高要市|