Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

159
Vistas
Resume the Ajax upload form when the Internet is connected

When the user's internet is connected, the upload is done and while uploading, the internet is suddenly disconnected and the form upload is failed.(status = (failed)net::ERR_INTERNET_DISCONNECTED , Type = xhr)

Is there a code that resumes the upload form after connecting to the Internet?

This is my upload code that is sent as Ajax:

$('#form_upload_create').submit(function (e) {
e.preventDefault();
$form = $(this)
var formData = new FormData(this);
$.ajax({
    url: window.location.pathname,
    type: 'POST',
    data: formData,
    cache: false,
    contentType: false,
    processData: false,
    success: function (response) {
           alert(response.message)
        }
    },
    xhr: function () {
        //upload Progress
        var xhr = $.ajaxSettings.xhr();
        if (xhr.upload) {
            xhr.upload.addEventListener('progress', function (event) {
                var percent = 0;
                var position = event.loaded || event.position;
                var total = event.total;
                if (event.lengthComputable) {
                    percent = Math.ceil(position / total * 100);
                }
                //update progressbar
                $(".progress-bar").css("width", +percent + "%");
                $(".status").text(percent + "%" + 'waiting upload...');
            }, true);
        }
        return xhr;
    },
});

});

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda