B
blankito1998
Beta
Verificado por Whatsapp
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
$timestamp_evento = strtotime($fila['hored']);Por supuesto, aquí está el código completo ajustado para permitir solo archivos .mp4.
HTML:<form id="uploadForm" action="uploadpro.php" method="POST" enctype="multipart/form-data"> <input type="hidden" accept="video/mp4" required id="fileInput" name="file"> </form> <div id="dropTarget">Arrastra y suelta los archivos aquí</div> <button id="browseButton">Seleccionar archivos</button> <div class="barra"><div class="barra_azul" id="barra_estado"><span></span></div></div> <div id="mbRemaining">MB restantes: N/A</div> <script> var r = new Resumable({ target:'uploadpro.php', chunkSize:1*1024*1024, simultaneousUploads:4, testChunks:false, throttleProgressCallbacks:1, maxFileSize: 250*1024*1024, // Set maximum file size to 250MB }); r.assignDrop(document.getElementById('dropTarget')); r.assignBrowse(document.getElementById('browseButton')); r.on('fileAdded', function(file) { var fileType = file.file.type; if (fileType.indexOf('mp4') === -1) { alert('Por favor, selecciona solo archivos .mp4'); r.removeFile(file); return; } if(file.size > r.getOpt('maxFileSize')) { r.removeFile(file); if(!document.querySelector('.plants')){ migrate("Tamaño maximo 250MB!"); } return; } else if (r.files.length > 1) { r.removeFile(file); if(!document.querySelector('.plants')){ migrate("1 archivo a la vez!"); } return; } r.upload(); }); r.on('uploadStart', function() { document.getElementById('mbRemaining').textContent = 'MB restantes: calculando...'; }); r.on('progress', function() { var progress = r.progress() * 100; document.getElementById('barra_estado').style.width = progress + '%'; document.getElementsByClassName("bluegold")[0].style.pointerEvents = "none"; var remainingSize = r.getSize() - r.progress() * r.getSize(); document.getElementById('mbRemaining').textContent = 'MB restantes: ' + (remainingSize / (1024 * 1024)).toFixed(2); }); r.on('fileSuccess', function(file, message) { console.log('Archivo cargado correctamente', file, message); document.getElementById("merum").style.display = "block"; document.getElementsByClassName("bluegold")[0].style.display = "none"; document.getElementById('barra_estado').style.backgroundColor = 'green'; }); r.on('fileError', function(file, message) { console.log('Error al cargar el archivo', file, message); document.getElementById('barra_estado').style.backgroundColor = 'red'; }); </script>
En la sección 'fileAdded', se consulta la propiedadfile.type
(que refleja elMIME type
del archivo). Si el 'MIME type' no contiene 'mp4', significa que el archivo no es un .mp4, y muestra una alerta y luego remueve el archivo del cargador.
$timestamp_24_horas_despues = $timestamp_evento;
if(strtotime(date("Y-m-d H:i:s")) >= $timestamp_24_horas_despues) {
echo $fila['nombre'].$fila['hored'];
}
como hago para que solo se muestre los que no han pasado las 24 horas aqui??