1

我有一个非常不寻常的情况。因此,该网站使用 SWF Upload 作为上传工具,并对其进行过滤,只允许上传图片。在开发和生产中对此进行测试可以正常工作。然而,在暂存环境中,当我尝试通过 Safari 或 Firefox 上传图像时,我收到一条显示 401 的警报。我知道 401 是一个身份验证错误,查看以前的解决方案,我已经使用了 post 参数,甚至将 use_query_string 的值设置为 true。现在,除了使用 Safari 或 Firefox 进行登台之外,这再次适用于所有可能的情况。我在下面粘贴了 SWFUpload 参数以进行验证。我该怎么做才能让它工作?谢谢!

swfu = new SWFUpload({
        // Backend Settings
        upload_url: "/digital/DigitalLibraryUploadHandler.ashx",
        post_params : 
        {
            "ASPSESSID" : "<%=Session.SessionID %>",
            "BATCHID" : batchId,
            "USERID" : userId
        },
        // File Upload Settings         
        file_types: "*.doc; *.flv; *.htm; *.html; *.jpg; *.pdf; *.swf; *.txt; *.xls",
        file_types_description : "Allowed Files",
        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,

        // Button settings
        //button_image_url : "/Images/swfUpload/XPButtonNoText_160x22.png",         
        button_image_url: "/Images/dl/but_add_image.png",
        button_placeholder_id : "spanButtonPlaceholder",
        button_width: 69,
        button_height: 16,
        //button_text : '<span class="button" style="z-index:-1">Upload</span>',
        //button_text : '<span class="button" style="text-align:center">Upload</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,
        button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
        button_cursor: SWFUpload.CURSOR.HAND,
        prevent_swf_caching : true,
        // Flash Settings
        flash_url: "/includes/swfUpload/swfupload.swf", // Relative to this file

        custom_settings : {
            upload_target : "divFileProgressContainer"
        },

        // Debug Settings
        debug: false,

        //Use Query String
        use_query_string: true
    });
4

1 回答 1

0

这是一个艰难的问题,但这是答案。要解决此问题,您需要转到 IIS 并编辑 ajax 处理程序的身份验证。将身份验证从 Windows 更改为匿名。仅当您不关心某些文件的身份验证时才应该这样做。

于 2013-05-29T15:39:32.133 回答