Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $file1 = mysqli_real_escape_string($con, $_POST['file1']);
- $file2 = mysqli_real_escape_string($con, $_POST['file2']);
- $file3 = mysqli_real_escape_string($con, $_POST['file3']);
- $file4 = mysqli_real_escape_string($con, $_POST['file4']);
- // DIVICION DE FILES
- $ext = 'jpeg,gif,png';
- $tPermitidoKB = 1000;
- $tipo = explode('/', $_FILES['file1']['type']);
- $file_ext = $tipo[1];
- //colocando imagen por default
- if (trim($_FILES['file1']['name']) != '') {
- //dando un nombre al archivo
- $file1 = $filenam.rand() .'.' . $file_ext;
- //confirmando que el archivo es permitido
- if (!strstr($ext, $file_ext)) {
- header('Location: nutricion_publicar.php?msn=Archivo no permitido');
- exit();
- }
- //Tamaño del archivo
- if ($_FILES['file1']['size'] / 1024 > $tPermitidoKB) {
- header('Location: nutricion_publicar.php?msn=Archivo excede el tamaño permitido');
- exit();
- }
- $archivo = true;
- } else {
- $file1 = '';
- $archivo = false;
- }
- // DIVICION DE FILES
- $ext = 'jpeg,gif,png';
- $tPermitidoKB = 1000;
- $tipo = explode('/', $_FILES['file2']['type']);
- $file_ext = $tipo[1];
- //colocando imagen por default
- if (trim($_FILES['file2']['name']) != '') {
- //dando un nombre al archivo
- $file2 = $filenam.rand() .'.' . $file_ext;
- //confirmando que el archivo es permitido
- if (!strstr($ext, $file_ext)) {
- header('Location: nutricion_publicar.php?msn=Archivo no permitido');
- exit();
- }
- //Tamaño del archivo
- if ($_FILES['file2']['size'] / 1024 > $tPermitidoKB) {
- header('Location: nutricion_publicar.php?msn=Archivo excede el tamaño permitido');
- exit();
- }
- $archivo = true;
- } else {
- $file2 = '';
- $archivo = false;
- }
- // DIVICION DE FILES
- $ext = 'jpeg,gif,png';
- $tPermitidoKB = 1000;
- $tipo = explode('/', $_FILES['file3']['type']);
- $file_ext = $tipo[1];
- //colocando imagen por default
- if (trim($_FILES['file3']['name']) != '') {
- //dando un nombre al archivo
- $file3 = $filenam.rand() .'.' . $file_ext;
- //confirmando que el archivo es permitido
- if (!strstr($ext, $file_ext)) {
- header('Location: nutricion_publicar.php?msn=Archivo no permitido');
- exit();
- }
- //Tamaño del archivo
- if ($_FILES['file3']['size'] / 1024 > $tPermitidoKB) {
- header('Location: nutricion_publicar.php?msn=Archivo excede el tamaño permitido');
- exit();
- }
- $archivo = true;
- } else {
- $file = '';
- $archivo = false;
- }
- // DIVICION DE FILES
- $ext = 'jpeg,gif,png';
- $tPermitidoKB = 1000;
- $tipo = explode('/', $_FILES['file4']['type']);
- $file_ext = $tipo[1];
- //colocando imagen por default
- if (trim($_FILES['file4']['name']) != '') {
- //dando un nombre al archivo
- $file4 = $filenam.rand() .'.' . $file_ext;
- //confirmando que el archivo es permitido
- if (!strstr($ext, $file_ext)) {
- header('Location: nutricion_publicar.php?msn=Archivo no permitido');
- exit();
- }
- //Tamaño del archivo
- if ($_FILES['file4']['size'] / 1024 > $tPermitidoKB) {
- header('Location: nutricion_publicar.php?msn=Archivo excede el tamaño permitido');
- exit();
- }
- $archivo = true;
- } else {
- $file = '';
- $archivo = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement