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
IE9
and the Chrome header
Notice the Chrome header has nothing listed under 'Cookies/Login'