Sí, en teoría, una carga reanudable debería poder pausarse cuando se pierde la conexión y luego continuar cuando se restablece la conexión. Sin embargo, esto puede depender de cómo se haya implementado la característica de carga reanudable en tu código PHP.
La carga de archivos en PHP normalmente no maneja la lógica de la carga reanudable por sí misma. Necesitarías una biblioteca o un script de terceros que implemente específicamente esta característica, o escribir tu propio código para manejarlo. Habitualmente, las cargas reanudables se logran dividiendo el archivo en partes y luego cargando estas partes una por una, de manera que si se interrumpe la conexión, solo se pierde una pequeña parte de la carga en lugar del archivo completo.
Si tu implementación actual no está reanudando las cargas después de una interrupción de la conexión, podría haber un problema con tu código o la biblioteca que estés usando. Te recomendaría revisar tu código y la documentación de cualquier biblioteca que estés usando para ver si puedes identificar el problema.
if(is_uploaded_file($_FILES['file']['tmp_name'])){
if (!empty($_FILES)) {
if(!isset($_SESSION['tempid'])){
$_SESSION['tempid'] = mt_rand(1,50).bin2hex(random_bytes(mt_rand(2,5)));
$_SESSION['ruta_destino'] = 'upload/'.mt_rand(1,100).bin2hex(random_bytes(mt_rand(5,15))).'.mp4';
}
$ruta_destino = $_SESSION['ruta_destino'];
$tempid = $_SESSION['tempid'];
$temp_archivo = $_FILES['file']['tmp_name'];
$numero_fragmento = $_POST['resumableChunkNumber'];
// Creamos la carpeta temporal si no existe
if (!file_exists("upload/aprobed")) {
mkdir("upload/aprobed", 0777, true);
}
// Mueve el archivo temporal a la carpeta temporal
file_put_contents("upload/aprobed/".$tempid.$_SESSION['email']."id" . $numero_fragmento, file_get_contents($temp_archivo));
}
if ($_POST['resumableChunkNumber'] == $_POST['resumableTotalChunks']) {
$total_fragmentos = $_POST['resumableTotalChunks'];
// Una vez todos los fragmentos están subidos, los combinamos
for ($i = 1; $i <= $total_fragmentos; $i++) {
$contenido_fragmento = file_get_contents("upload/aprobed/".$tempid.$_SESSION['email']."id" . $i);
file_put_contents($ruta_destino, $contenido_fragmento, FILE_APPEND);
}
// Finalmente, eliminamos los fragmentos temporales
for ($i = 1; $i <= $total_fragmentos; $i++) {
unlink("upload/aprobed/".$tempid.$_SESSION['email']."id" . $i);
}
}
if($numero_fragmento == 1){
$mocheauss = mysqli_query($conexion,"SELECT MAX(hora) AS hora FROM watch limit 0,1");
$guyears = mysqli_fetch_assoc($mocheauss);
$horato=$guyears['hora']+1;
$query_exitosa = mysqli_query($conexion,"INSERT INTO
watch
(tempid,hora,fecha,waiting,get_id,target,hored,email,newmodevideo) VALUES ('".$tempid.$_SESSION['email']."id"."','".$horato."','".date('d M Y')."','".mt_rand(1,8).bin2hex(random_bytes(mt_rand(6,10)))."','".mt_rand(1,5).bin2hex(random_bytes(mt_rand(3,10)))."','".mt_rand(1,10).bin2hex(random_bytes(mt_rand(5,10)))."','".date("Y-m-d H:i:s",strtotime($fecha_actual."+ 72 hours"))."','".$_SESSION['email']."','".$ruta_destino."')");
}
$esUltimoFragmento = ($_POST['resumableChunkNumber'] == $_POST['resumableTotalChunks']);
if ($esUltimoFragmento) {
unset($_SESSION['tempid']);
unset($_SESSION['ruta_destino']);
$resultadas = mysqli_query($conexion, "SELECT MAX(id) AS max_id FROM watch WHERE email='".$_SESSION['email']."'");
$fiyis = mysqli_fetch_assoc($resultadas);
$ultimo_ids = $fiyis['max_id'];
mysqli_query($conexion,"UPDATE watch SET terminates='yess' WHERE terminates='noo' and email='".$_SESSION['email']."' and id='".$ultimo_ids."'");
}
}
aqui deberia de reanudar verdad?