SWFUpload上传

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SWFUPload_Demo.aspx.cs" Inherits="BookShop.Web.Test.SWFUPload_Demo" %>


<!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>
    <script src="../js/jquery-1.7.1.js" type="text/javascript"></script>
    <script src="../SWFUpload/handlers.js" type="text/javascript"></script>
    <script src="../SWFUpload/swfupload.js" type="text/javascript"></script>
    <script type="text/javascript">
        var swfu;
        window.onload = function () {
            swfu = new SWFUpload({
                // Backend Settings
                upload_url: "/ashx/upload.ashx",
                post_params: {
                    "ASPSESSID": "<%=Session.SessionID %>"
                },


                // File Upload Settings
                file_size_limit: "2 MB",
                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.
                swfupload_preload_handler: preLoad,
                swfupload_load_failed_handler: loadFailed,
                file_queue_error_handler: fileQueueError,
                file_dialog_complete_handler: fileDialogComplete,
                upload_progress_handler: uploadProgress,
                upload_error_handler: uploadError,
                upload_success_handler: show,//上传完成的方法
                upload_complete_handler: uploadComplete,


                // Button settings
                button_image_url: "/SWFUpload/images/XPButtonNoText_160x22.png",
                button_placeholder_id: "spanButtonPlaceholder",
                button_width: 160,
                button_height: 22,
                button_text: '<span class="button">Select Images <span class="buttonSmall">(2 MB Max)</span></span>',
                button_text_style: '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }',
                button_text_top_padding: 1,
                button_text_left_padding: 5,


                // Flash Settings


                flash_url: "../SWFUpload/swfupload.swf", // Relative to this file
                flash9_url: "../SWFUpload/swfupload_FP9.swf", // Relative to this file


                custom_settings: {
                    upload_target: "divFileProgressContainer"
                },


                // Debug Settings
                debug: false
            });
        }
        function show(file, serverData) {
            var s = serverData.split(':'); //接收从服务端返回的数据,按照分号分隔
            if (s[0] == "ok") {
                $("#imgSrc").attr("src", s[1]);
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
  




<div id="content">
  

   <div id="swfu_container" style="margin: 0px 10px;">
   <div>
<span id="spanButtonPlaceholder"></span>
   </div>
   <div id="divFileProgressContainer" style="height: 75px;"></div>
   <div id="thumbnails"></div>
             <img id="imgSrc" />
   </div>
</div>
    </form>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值