Last active
November 17, 2015 16:13
-
-
Save joariasl/9c9df943effeb3c8d1d3 to your computer and use it in GitHub Desktop.
Guardar archivo en PHP (ejemplo, no resuelto conflicto de nombre)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if($_FILES['file']['type'] === 'application/pdf'){// Siendo 'file' el name del parametro recibido | |
$uploaddir = './var/';// Especificar ruta de destino en folder | |
$time_file = time(); | |
$file_name = date('YmdHis', $time_file).'.pdf'; | |
$uploadfile = $uploaddir . $file_name;//Nombre del archivo sera fecha | |
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {// Si guarda correctamente hacer | |
/* TODO - Archivo guardado */ | |
echo "Archivo $file_name guardado correctamente"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Para leer y retornar PDF: