我有一个非常不寻常的情况。因此,该网站使用SWF上传作为上传工具,并将其过滤为仅允许图片上传。在开发和生产中对此进行测试工作正常。然而,在暂存环境中,当我尝试通过Safari或Firefox上传图像时,我收到一条401的警告。我知道401是一个身份验证错误并且查看以前的解决方案,我已经使用了post params甚至将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
});
答案 0 :(得分:0)
这是一个艰难的,但这就是答案。要解决此问题,您需要转到IIS并编辑ajax处理程序的身份验证。将身份验证从Windows更改为Anonymous。只有在您不关心某些文件的身份验证时才应该这样做。