Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created January 16, 2021 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/9d5835f722b9d5a3b5619b96ebdfdb95 to your computer and use it in GitHub Desktop.
Save parzibyte/9d5835f722b9d5a3b5619b96ebdfdb95 to your computer and use it in GitHub Desktop.
<?php
$conteo = count($_FILES["archivos"]["name"]);
for ($i = 0; $i < $conteo; $i++) {
$ubicacionTemporal = $_FILES['archivos']['tmp_name'][$i];
$nombreArchivo = $_FILES["archivos"]["name"][$i];
$extension = pathinfo($nombreArchivo, PATHINFO_EXTENSION);
$nuevoNombre = sprintf("%s_%d.%s", uniqid(), $i, $extension);
move_uploaded_file($ubicacionTemporal, $nuevoNombre);
}
header("Location: index.php");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment