1

I've implemented Uploadify below. The files uploaded will be eventually saved to a database but as of right now I'm just checking that Uploadify can access the service. It succeeds in IE, Firefox, and Safari but fails in Chrome when I or someone else on my domain hits my webserver at http://machine_name.my_domain.com/SiteName/

I have Windows Authentication enabled in IIS Manager and given the testing users permissions.

However, all browsers work fine in IIS Express development.

<input id="inputUploadify" type="file" name="inputUploadify" />

$("#inputUploadify").uploadify({
    "buttonImg": "uploadify/customSelect.png",
    "rollover": true,
    "width": 156,
    "height": 40,
    "uploader": "uploadify/uploadify.swf",
    "expressInstall": "uploadify/expressInstall.swf",
    "script": "Services/Uploadify.ashx",
    "cancelImg": "uploadify/cancel.png",
    "scriptData": { "photoGalleryId": "<%=_photoGalleryId %>" },
    "auto": false,
    "multi": true,
    "fileDesc": "Image files (*.jpg, *.jpeg, *.png)",
    "fileExt": "*.jpg;*.jpeg;*.png;",
    "sizeLimit": 1048576, //1 MB limit
    "removeCompleted": false,
    "fileDataName": "fileData",
    "onAllComplete": function (event, data) {
        if (data.errors == 0) {
            alert("Your images have been uploaded.");
        }
        else {
            alert("There was an error uploading images.");
        }
    },
    "onError": function (event, ID, fileObj, errorObj) {
        alert("type " + errorObj.type + " " + errorObj.info);
    },
    "onSelect": function (event, ID, fileObj) {
        if (fileObj.size > 1048576) { // 1MB
            alert("file '" + fileObj.name + " is too large.");
            $(this).uploadifyCancel(ID);
            return false;
        }
    }
});

This is the basic handler.

public class Uploadify : IHttpHandler
{
    public void ProcessRequest(HttpContext context) {
        HttpPostedFile file = context.Request.Files["fileData"];
        int photoGalleryId = int.Parse(context.Request["photoGalleryId"]);
        context.Response.ContentType = "text/plain";
        context.Response.Write("success");
    }

    public bool IsReusable {
        get {
            return false;
        }
    }
}

Fiddler shows this as the 401 error

HTTP Error 401.2 - Unauthorized

You are not authorized to view this page due to invalid authentication headers.

This is the header from Firefox

Firefox Header

IE9

IE Header

and the Chrome header

Chrome Header




Notice the Chrome header has nothing listed under 'Cookies/Login'


Community
  • 1
  • 1
W. Young
  • 357
  • 7
  • 18
  • How does it fail? Are you getting errors? Is the file getting uploaded and failing at the server? – abraham Feb 28 '12 at 22:30
  • You might want to provide a bit more info regarding the chrome failure. For example, are there any script errors? Does the uploadify stuff actually load? Basically, at what point do you know there is a problem and what code is executing at that time? – NotMe Feb 28 '12 at 22:31
  • I added that I can see the 401.2 HTTP error in Fiddler with Chrome and I set a breakpoint in the handler which is never reached. – W. Young Feb 28 '12 at 22:37
  • I added images from Fiddler that show the request headers from each browser. Notice the Chrome header has nothing under the 'Cookies / Login' section. – W. Young Feb 29 '12 at 15:52

0 Answers0