Topic: plupload just sending me to directory listing in IE
I am using plupload for my website, and as usual, everything works fine in chrome and firefox, but doesn't work at all in Internet Explorer 9.
When I click the browse button, IE is just spitting me to the current directory listing.
I can't seem to figure it out, so I am asking you guys for help!
Here is my plupload.js file
window['TESTSITE'] = new Object();
window['TESTSITE']['Plupload'] = new Object();
var uploader = '';
filesJustUploaded = new Array();
TESTSITE.Plupload.Instances = new Array();
TESTSITE.Plupload.Setup = function(folderName, containerID, browseButtonID, uploadButtonID, fileListID, autoStart, submitButtonClass, disabledSubmitButtonClass, businessId, projectId, contactId, allowDescriptions, attachmentType)
{
//console.log("bid:"+businessId+" pid"+projectId+" cid:"+contactId);
// make sure to only create the uploader once
if (!(browseButtonID in TESTSITE.Plupload.Instances))
{
TESTSITE.Plupload.Instances[browseButtonID] = containerID;
var runtimeList = 'html5,flash,html4';
var submitButtonText = '';
/* if (navigator.appName.indexOf('Internet Explorer') > -1)
{
runtimeList = 'html5,flash,html4';
}*/
uploader = new plupload.Uploader({
runtimes: runtimeList,
browse_button: browseButtonID,
container: containerID,
max_file_size: '100mb',
url: 'PluploadHandler.php?action=upload&folder=' + folderName + '&bid=' + businessId.toString() + '&pid=' + projectId.toString() + '&cid=' + contactId.toString() + '&type=' + attachmentType.toString(),
resize: { width: 320, height: 240, quality: 90 }
});
uploader.bind('Init', function(up, params)
{
//console.log('init');
//console.log(up);
//console.log(params);
//$j('#' + fileListID).html("<div>Current runtime: " + params.runtime + "</div>");
});
jQuery('#' + uploadButtonID).click(function(e)
{
//$('#folderTreeView').jstree('search','foldertreeview'+folder);
uploader.start();
e.preventDefault();
});
jQuery('#' + browseButtonID).click(function(e)
{
if(attachmentType.toString() == 'ProjectFiles')
{
//console.log("folder:"+folderTreeViewCurSelected.rslt.obj.data("id"));
// uploader.settings.url="/members/PluploadHandler.php?action=upload&folder="+folderTreeViewCurSelected.rslt.obj.data("id")+"&bid="+businessId.toString()+"&pid="+projectId.toString()+"&cid="+contactId.toString()+"&type=ProjectFiles";
}
else if(attachmentType.toString() == 'Document')
{
//console.log(attachmentType.toString());
// curDoc = CurrentDocumentId;
//console.log('curdoc:**'+curDoc+'**');
uploader.settings.url='PluploadHandler.php?action=upload&docID='+curDoc+'&folder=' + folderName + '&bid=' + businessId.toString() + '&pid=' + projectId.toString() + '&cid=' + contactId.toString() + '&type=' + attachmentType.toString();
//console.log(uploader.settings.url);
}
});
uploader.init();
uploader.bind('FilesAdded', function(up, files)
{
var boolOKToUpload = true;
if(attachmentType.toString() == 'ProjectFiles')
{
//console.log(files);
newFile = files[0].name;
fileList = folderTreeViewCurSelected.rslt.obj.data("files");
//Check to make sure we havent uploaded file since opening window
for(j=0;j<filesJustUploaded.length;j++)
{
if(newFile == filesJustUploaded[j])
{
boolOKToUpload = false;
}
}
filesJustUploaded.push(newFile);
for(i=0;i<fileList.length;i++)
{
// console.log(fileList[i]);
if(newFile == fileList[i].FileName)
{
boolOKToUpload = false;
break;
}
}
}
if(!boolOKToUpload)
{
var r=confirm(newFile+" already exists, overwrite?");
if (r!=true)
{
boolOKToUpload = false
}
else
{
if(attachmentType.toString() == 'ProjectFiles')
{
uploader.settings.url="/members/PluploadHandler.php?action=overwrite&folder="+folderTreeViewCurSelected.rslt.obj.data("id")+"&bid="+businessId.toString()+"&pid="+projectId.toString()+"&cid="+contactId.toString()+"&type=ProjectFiles"
boolOKToUpload = true;
}
}
}
if(boolOKToUpload)
{
if (submitButtonClass != null && submitButtonClass != '' && disabledSubmitButtonClass != null && disabledSubmitButtonClass != '')
{
jQuery('.' + submitButtonClass).hide();
jQuery('.' + disabledSubmitButtonClass).show();
}
jQuery.each(files, function(i, file)
{
jQuery('#' + fileListID).append(
'<div id="' + file.id + '" style="width: 75%;"><span style="float: right;"></span>' +
file.name + ' (' + plupload.formatSize(file.size) + ') <b></b><div class="clear" style="clear: both; height: 1px; line-height: 1px; overflow: hidden;"></div>' +
'</div>');
});
up.refresh(); // Reposition Flash/Silverlight
if (autoStart)
{
uploader.start();
}
}
});
uploader.bind('UploadProgress', function(up, file)
{
jQuery('#' + file.id + " b").html(file.percent + "%");
});
uploader.bind('Error', function(up, err)
{
if (submitButtonClass != null && submitButtonClass != '' && disabledSubmitButtonClass != null && disabledSubmitButtonClass != '')
{
jQuery('.' + submitButtonClass).show();
jQuery('.' + disabledSubmitButtonClass).hide();
}
jQuery('#' + fileListID).append("<div>Error: " + err.code +
", Message: " + err.message +
(err.file ? ", File: " + err.file.name : "") +
"</div>"
);
up.refresh(); // Reposition Flash/Silverlight
});
uploader.bind('FileUploaded', function(up, file)
{
jQuery('#' + file.id + " b").html("100%");
if (allowDescriptions)
{
jQuery('#' + file.id + " span").html(' <input style="width: 175px; font-size: 14px;" id="' + folderName + '_' + file.name + '" name="' + folderName + '_' + file.name + '" type="text" />');
}
});
uploader.bind('UploadComplete', function(up, files)
{
if (submitButtonClass != null && submitButtonClass != '' && disabledSubmitButtonClass != null && disabledSubmitButtonClass != '')
{
jQuery('.' + submitButtonClass).show();
jQuery('.' + disabledSubmitButtonClass).hide();
}
});
}
}
jQuery(document).ready(function()
{
if (!window.BlobBuilder && window.WebKitBlobBuilder)
window.BlobBuilder = window.WebKitBlobBuilder;
});