ajaxfileupload.js no puede cargar imágenes en IE, Firefox y Google funcionan.
Aquí hay información sobre cómo manejar la compatibilidad con IE. Puedes revisarla y ver si funciona.
jQuery.extend({
createUploadIframe: función. (id , uri)
{
//crear marco
var frameId = 'jUploadFrame' + id;
if(ventana .ActiveXObject ) {
if(jQuery.browser.version=="9.0"||jQuery.browser.version=="10.0"||jQuery.browser.version=="11.0"){
var io = document.createElement('iframe');
io.id = frameId;
io.name = frameId;
} else if(jQuery.browser.version=="6.0" || jQuery.browser.version=="7.0" || jQuery.browser.version=="8.0"){
var io = documento .createElement('');
if(typeof uri== 'boolean'){
io.src = 'javascript:false';
}
else if(typeof uri== 'string'){
io = uri;
}
}
}
más {
var io = documento. .createElement ('iframe');
io.id = frameId;
io.name = frameId;
}
io .style .position = 'absoluta';
io.style.top = '-1000px';
io.style.left = '-1000px';
document.body.appendChild(io);
return io;
},
createUploadForm: function(id, fileElementId)
{
//crear formulario
var formId = 'jUploadForm' + id;
var fileId = 'jUploadFile' + id;
var formulario = $('
;/form>');
var oldElement = $('#' + fileElementId);
var newElement = $(oldElement).clone();
$(oldElement).attr('id', fileId);
$(oldElement).before(newElement);
$(oldElement).appendTo(form);
//establecer atributos
$(formulario).css('posición', 'absoluta');
$(formulario).css('arriba ', '-1200px');
$(form).css('left', '-1200px');
$(form).appendTo('body') ;
formulario de devolución;
},
addOtherRequestsToForm: función(formulario,datos)
{
// agregar parámetro adicional
var originalElement = $('');
for (var clave en datos ) {
nombre = clave;
valor = datos[clave];
var cloneElement = originalElement.clone();
cloneElement.attr({'nombre':nombre,'valor':valor});
$(cloneElement).appendTo(formulario);
}
formulario de devolución;
},
ajaxFileUpload: function(s) {
// TODO introduce configuraciones globales, permitiendo al cliente modificarlas para todas las solicitudes , no solo tiempo de espera
s = jQuery.extend({}, jQuery.ajaxSettings, s);
var id = new Date().getTime()
var formulario = jQuery.createUploadForm(id, s.fileElementId);
if ( s.data ) formulario = jQuery.addOtherRequestsToForm(form,s.data);
var io = jQuery.createUploadIframe(id, s.secureuri);
var frameId = 'jUploadFrame' + id;
var formId = 'jUploadForm' + id
<; p> // Esté atento a un nuevo conjunto de requisitosuests
if ( s.global && ! jQuery.active++ )
{
jQuery.event.trigger( "ajaxStart" );
}
var requestDone = false;
// Crea el objeto de solicitud
var xml = {}
if ( s .global )
jQuery.event.trigger("ajaxSend", [xml, s]);
// Espera a que llegue una respuesta
var uploadCallback = function(isTimeout)
{
var io = document.getElementById(frameId);
prueba
{ p>
p>
if(io.contentWindow)
{
xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body .innerHTML:null;
xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
}else if(io .contentDocument) p>
{
xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
xml .responseXML = io. contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
}
}catch(e)
{
p>
jQuery.handleError(s, xml, null, e);
}
if ( xml || isTimeout = = "tiempo de espera")
{
requestDone = true;
var status;
prueba {
estado = isTimeout! =
"timeout" ? "success" : "error";
// Asegúrese de que la solicitud haya sido exitosa o no haya sido modificada
if ( status != "error" )
{
// procesa los datos (ejecuta el xml a través de pleted
if( s.global )
jQuery.event.trigger( "ajaxComplete ", [xml, s] );
// Maneja el contador AJAX global
if ( s.global && ! --jQuery.active )
jQuery.event.trigger( "ajaxStop" );
// Resultado del proceso
if ( s.complete )
s.complete(xml, status) ;
jQuery(io).unbind()
setTimeout(function()
{ probar
{
$(io).remove();
$(formulario).remove();
} catch(e)
{
jQuery.handleError(s, xml, null, e);
}
}, 100)
xml = null
}
}
// Comprobador de tiempo de espera
if ( s.timeout > 0 )
{
setTimeout(function(){
// Verifica si la solicitud aún continúa
if( !requestDone ) uploadCallback( "timeout" );
}, s.timeout);
}
prueba
{
// var io = $('# ' + frameId);
<p> var formulario = $('#' + formId);
$(form).attr('action', s.url);
$(form).attr ('método', 'POST');
$(formulario).attr('objetivo', frameId);
if(form.encoding)
{
form.encoding = 'multipart/form-data';
}
else
{
form.enctype = 'multipart/form-data';
}
$(formulario).submit();
} catch(e)
{
jQuery.handleError(s, xml, null, e);
}
if(window.attachEvent){
document.getElementById(frameId).attachEvent('onload', uploadCallback);
}
else{
document.getElementById (frameId).addEventListener('load', uploadCallback, false);
}
return {abort: function () {}}
};
uploadHttpData: función( r, tipo ) {
var datos = !tipo;
datos = tipo == "xml" || respuestaXML : r.responseText;
// Si el tipo es "script", evalúelo en contexto global
if ( type == "script" )
jQuery.globalEval( data );
// Obtiene el objeto JavaScript, si se usa JSON.
if ( type == "json" )
eval( "data = " + data );
// evalúa scripts dentro de html
if ( type == "html" )
jQuery("< div>").html(datos).evalScripts();
//alert($('param', data).each(function(){alert($(this).attr('value'));}));
devolver datos; p>
}
})