Changeset fbcfb98 in portal_2019 for php/header.php
- Timestamp:
- Oct 31, 2023, 4:15:08 PM (7 months ago)
- Branches:
- master, dev
- Parents:
- 9e98ae1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
php/header.php
r0155753 rfbcfb98 1 <?php 2 // Consultar el valor de upload_max_filesize o el tamaño máximo permitido 3 // para un archivo que se envía al servidor. 4 $maxFileSize = ini_get('upload_max_filesize'); 5 ?> 6 1 7 <header> 2 8 <div class="cintillo"> … … 12 18 </div> 13 19 </header> 20 21 <script> 22 /** 23 * Función para verificar el tamaño del archivo seleccionado y mostrar una 24 * alerta si es demasiado grande en comparación con el valor máximo permitido. 25 * @param {HTMLInputElement} input - El elemento de entrada de archivo. 26 */ 27 function checkFileSize(input) { 28 if (input.files.length > 0) { 29 // Tamaño máximo en bytes 30 const maxSize = parseInt('<?php echo $maxFileSize; ?>') * 1024 * 1024; 31 32 const fileSize = input.files[0].size; 33 34 if (fileSize > maxSize) { 35 alert( 36 "El archivo seleccionado es demasiado grande, el " + 37 "tamaño máximo permitido es <?php echo $maxFileSize; ?>." 38 ); 39 /* Limpiar el valor del input para que el usuario seleccione otro archivo. */ 40 input.value = ""; 41 } 42 } 43 } 44 </script>
Note: See TracChangeset
for help on using the changeset viewer.