Question

I have a really unusual situation. So the site uses SWF Upload as the upload tool and it's filtered to only allow image uploads. Testing this in development and in production work fine. However in the staging environment, when I try to upload an image through Safari or Firefox, I get an alert that says 401. I know that 401 is an authentication error and looking at previous solutions, I've already used the post params and even set the value of use_query_string to true. Now once again this works everywhere and in every possible situation except for staging using Safari or Firefox. I've pasted the SWFUpload parameters below for verification. What can I do to get it working? Thanks!

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
    });
Was it helpful?

Solution

This was a tough one but here's the answer. To fix this, you need to go to IIS and edit the authentication of the ajax handler. Change the authentication from Windows to Anonymous. This should only be done if you don't care about the authentication of certain files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top