Ver Mensaje Individual
  #5 (permalink)  
Antiguo 27/03/2013, 16:39
yonatanalexis22
 
Fecha de Ingreso: marzo-2013
Mensajes: 2
Antigüedad: 11 años, 1 mes
Puntos: 0
De acuerdo Respuesta: jQuery.ajax() Enctype

Cita:
Iniciado por yonatanalexis22 Ver Mensaje
Claro que mediante Ajax se puede enviar archivos, solo tienes que configurar el enctype: 'multipart/form-data', y quitar el data serialize es algo parecido a esto
Código HTML:
Ver original
  1. $('#upform').submit(function(e) {
  2.                     e.preventDefault();
  3.                   var dat = new FormData($(this)[0]);
  4.                     $.ajax({
  5.                         beforeSend: function() {
  6.                             $('#msm').html('un momento por favor');
  7.                         },
  8.                         url: pet,
  9.                         type: met,
  10.                         enctype: 'multipart/form-data',
  11.                         data: dat,
  12.                         success: function(resp) {
  13.  
  14.                             $('#msm').html(resp);
  15.                             alert(resp);
  16.  
  17.                         },
  18.                                 cache: false,
  19.                         contentType: false,
  20.                         processData: false,
  21.                         error: function(jqXHR, estado, error) {
  22.                             alert(estado + " " + error);
  23.                         },
  24.                         complete: function(jqXHR, estado) {
  25.  
  26.                             //  alert('completo' + estado);
  27.  
  28.  
  29.  
  30.  
  31.                         }