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

487
Vistas
SEND BLOB VIDEO (FROM WEBRTC) TO A MYSQL SERVER IN PHP

I have tried using some code to get blob uploaded to server, but this code has not functioned as intended. need help in finding where the error is and perhaps how to upload blob video to MySQL server.

The js code I used is

var blob = URL.createObjectURL(recorder.getBlob());
var fd = new FormData();
fd.append('fname', 'test.mp4');
fd.append('data', blob);
$.ajax({
    type: 'POST',
    url: '../../application/controllers/upload.php',
    data: fd,
    processData: false,
    contentType: false
}).done(function(data) {
    alert(data);
});

Then this is the PHP code I tried

foreach(array('video', 'audio') as $type) {
    if (isset($_FILES["${type}-blob"])) {

        echo 'uploads/';
        $fileName = $_POST["${type}-filename"];
        $uploadDirectory = 'uploads/'.$fileName;

        if (!move_uploaded_file($_FILES["${type}-blob"]["tmp_name"], $uploadDirectory)) {
            echo(" problem moving uploaded file");
        }
        echo($fileName);
    }
}

Once I am able to get this working I can be able to insert the data into MySQL database Thank you for helping

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

you placed your blob into your formdata OBJECT and called it data

fd.append('data', blob);

So when that gets to PHP is will be placed in

$_FILES['data']

Just like as if you had done

<input type="file" name="data">
about 4 years ago · Santiago Gelvez Denunciar
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