zoukankan      html  css  js  c++  java
  • Swfupload 实现大文件上传(MVC3)

    SWFUpload V2.2.0 说明中文文档地址:

    http://leeon.me/upload/other/swfupload.html#statsobject

    实现效果:

    Js代码:

    <script src="/Scripts/SWFUpload/swfupload.js" type="text/javascript"></script>
    <script src="/Scripts/SWFUpload/plugins/swfupload.queue.js" type="text/javascript"></script>
    <script src="/Scripts/SWFUpload/plugins/swfupload.speed.js" type="text/javascript"></script>
    <script src="/Scripts/SWFUpload/handlers.js" type="text/javascript"></script>
    <script type="text/javascript">
    var swfu;
    window.onload = function () {
    swfu = new SWFUpload({
    upload_url: "/Demo/Swfupload",
    flash_url: "/Scripts/SwfUpload/Flash/swfupload.swf",
    file_size_limit: "300 MB",
    file_types: "*.doc;*.docx;*.ppt;*.pptx;*.pdf;*.xls;*.xlsx",
    file_types_description: "Select Files",
    file_upload_limit: 20,
    file_queue_limit: 20,
    debug: false,
    button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,

    // Button settings
    button_image_url: "/Content/images/adddoc.gif",
    button_ "140",
    button_height: "35",
    button_placeholder_id: "spanButtonPlaceHolder",
    button_text_left_padding: 12,
    button_text_top_padding: 3,
    button_action: -110,

    // The event handler functions are defined in handlers.js
    swfupload_preload_handler: preLoad,
    swfupload_load_failed_handler: loadFailed,
    file_queued_handler: fileQueued,
    file_dialog_complete_handler: fileDialogComplete,
    upload_start_handler: uploadStart,
    upload_progress_handler: uploadProgress,
    upload_success_handler: uploadSuccess,
    upload_complete_handler: uploadComplete,
    upload_error_handler: uploadError,
    file_queue_error_handler: fileQueueError
    });
    $("#btnSubmit").click(function () {
    if (swfu.getStats().files_queued > 0) {
    swfu.startUpload();
    }
    });
    };

    function cancelFile(file_id) {
    swfu.cancelUpload(file_id);
    $("#" + file_id).slideUp("slow");
    return false;
    }

    function cancelFileQueue(file_id) {
    swfu.cancelUpload(file_id);
    return false;
    }

  • 相关阅读:
    JavaScript中DOM的层次节点(一)
    JS可维护性代码
    Angular页面加载闪现解决方案 ng-cloak
    无法向会话状态服务器发出会话状态请求。
    算法题--拓扑排序
    2020年04月25日个人赛
    Educational Codeforces Round 86 (Rated for Div. 2)
    博弈--巴什博弈
    2020年04月19日个人赛
    AtCoder Beginner Contest 163(D)
  • 原文地址:https://www.cnblogs.com/zcm123/p/3099093.html
Copyright © 2011-2022 走看看