swfupload控件404错误


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

    <script src="swfupload/swfupload.js" type="text/javascript"></script>
   

    <script src="swfupload/swfupload.queue.js" type="text/javascript"></script>
   

    <script src="swfupload/fileprogress.js" type="text/javascript"></script>

    <script src="swfupload/handlers.js" type="text/javascript"></script>
   

    <link href="swfupload/default.css" rel="stylesheet" type="text/css" />
   
<script type="text/javascript">
    var swfu;

    window.onload = function() {

    //js获取项目根路径,如: http://localhost:8083/uimcardprj
    function getRootPath() {
        //获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp
        var curWwwPath = window.document.location.href;
        //获取主机地址之后的目录,如: uimcardprj/share/meun.jsp
        var pathName = window.document.location.pathname;
        var pos = curWwwPath.indexOf(pathName);
        //获取主机地址,如: http://localhost:8083
        var localhostPaht = curWwwPath.substring(0, pos);
        //获取带"/"的项目名,如:/uimcardprj
        var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
        return (localhostPaht);
    }
        var settings = {
            flash_url: "swfupload/swfupload.swf",
            upload_url: getRootPath() + "/swfupload/imageUp.ashx", //这里填写错误会出现404错误
            post_params: { "PHPSESSID": "" },
            file_size_limit: "100 MB",
            file_types: "*.*",
            file_types_description: "All Files",
            file_upload_limit: 100,
            file_queue_limit: 0,
            custom_settings: {
                progressTarget: "fsUploadProgress",
                cancelButtonId: "btnCancel"
            },
            debug: false,

            // Button settings
            button_image_url: getRootPath() + "/swfupload/up.png",//从根目录开始
            button_width: "65",
            button_height: "29",
            button_placeholder_id: "spanButtonPlaceHolder",
            button_text: '<span class="theFont">上传</span>',
            button_text_style: ".theFont { font-size: 16; }",
            button_text_left_padding: 12,
            button_text_top_padding: 3,

            // The event handler functions are defined in handlers.js
            file_queued_handler: fileQueued,
            file_queue_error_handler: fileQueueError,
            file_dialog_complete_handler: fileDialogComplete,
            upload_start_handler: uploadStart,
            upload_progress_handler: uploadProgress,
            upload_error_handler: uploadError,
            upload_success_handler: uploadSuccess,
            upload_complete_handler: uploadComplete,
            queue_complete_handler: queueComplete // Queue plugin event

        };

        swfu = new SWFUpload(settings);
    };
 </script>
</head>
<body>

 
<div id="content">
 <h2>图片上传</h2>
 <form id="form1" action="../swfupload/imageUp.ashx" method="post" enctype="multipart/form-data">
  
   <div class="fieldset flash" id="fsUploadProgress">
   <span class="legend">上传图片</span>
   </div>
  <div id="divStatus">0 个文件完成</div>
   <div>
    <span id="spanButtonPlaceHolder"></span>
    <input id="btnCancel" type="button" value="取消所有上传" οnclick="swfu.cancelQueue();" disabled="disabled" style="margin-left: 2px; font-size: 8pt; height: 29px;" />
   </div>
 
 </form>
</div>
</body>
</html>

 

转载于:https://www.cnblogs.com/nanxiaoxiang/archive/2012/08/16/2642023.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值