Add files via upload

This commit is contained in:
Fernando Méndez 2021-05-19 10:09:05 +02:00 committed by GitHub
parent 17cb21683e
commit 8de7a1d0cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 68 additions and 14 deletions

View File

@ -400,19 +400,46 @@
.promotions img { .promotions img {
width: 100%; width: 100%;
height: 150px; height: 150px;
display: block;
margin-left: auto;
margin-right: auto;
background-size: cover; background-size: cover;
border-radius: 10px;
border-style: dashed;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(255, 255, 255, 0.19);
} }
.promotions button { .promotions button {
margin-top: 5%; margin: 1em 1em 0 1em;
background-repeat: no-repeat;
height: 125px;
width: 125px;
background-position: center;
} }
.controls { .controls {
text-align: center; text-align: center;
} }
.controls #play {
height: 30px;
width: 30px;
border-radius: 25px;
background-repeat: no-repeat;
background-position: center;
}
.controls #stop {
height: 30px;
width: 30px;
border-radius: 25px;
background-repeat: no-repeat;
background-position: center;
}
/* Responsive layout */ /* Responsive layout */
@media (max-width: 750px) { @media (max-width: 750px) {
.promotions button {
margin: 0 1em 0 1em;
}
.promotions img { .promotions img {
width: 100%; width: 100%;
height: 50px; height: auto;
} }
} }

View File

@ -435,19 +435,46 @@ main img {
.promotions img { .promotions img {
width: 100%; width: 100%;
height: 150px; height: 150px;
display: block;
margin-left: auto;
margin-right: auto;
background-size: cover; background-size: cover;
border-radius: 10px;
border-style: dashed;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(255, 255, 255, 0.19);
} }
.promotions button { .promotions button {
margin-top: 5%; margin: 1em 1em 0 1em;
background-repeat: no-repeat;
height: 125px;
width: 125px;
background-position: center;
} }
.controls { .controls {
text-align: center; text-align: center;
} }
.controls #play {
height: 30px;
width: 30px;
border-radius: 25px;
background-repeat: no-repeat;
background-position: center;
}
.controls #stop {
height: 30px;
width: 30px;
border-radius: 25px;
background-repeat: no-repeat;
background-position: center;
}
/* Responsive layout */ /* Responsive layout */
@media (max-width: 750px) { @media (max-width: 750px) {
.promotions button {
margin: 0 1em 0 1em;
}
.promotions img { .promotions img {
width: 100%; width: 100%;
height: 50px; height: auto;
} }
} }

View File

@ -41,7 +41,7 @@ class FormUploadFiles extends Form {
$archivo = $_FILES['archivo']; $archivo = $_FILES['archivo'];
$nombre = $_FILES['archivo']['name']; $nombre = $_FILES['archivo']['name'];
/* 1.a) Valida el nombre del archivo */ /* 1.a) Valida el nombre del archivo */
$ok = check_file_uploaded_name($nombre) && check_file_uploaded_length($nombre) ; $ok = $this->check_file_uploaded_name($nombre) && $this->check_file_uploaded_length($nombre) ;
/* 1.b) Sanitiza el nombre del archivo /* 1.b) Sanitiza el nombre del archivo
$ok = sanitize_file_uploaded_name($nombre); $ok = sanitize_file_uploaded_name($nombre);
*/ */
@ -82,7 +82,7 @@ class FormUploadFiles extends Form {
* @author Yousef Ismaeil Cliprz * @author Yousef Ismaeil Cliprz
* @See http://php.net/manual/es/function.move-uploaded-file.php#111412 * @See http://php.net/manual/es/function.move-uploaded-file.php#111412
*/ */
function check_file_uploaded_name ($filename) { protected function check_file_uploaded_name ($filename) {
return (bool) ((mb_ereg_match('/^[0-9A-Z-_\.]+$/i',$filename) === 1) ? true : false ); return (bool) ((mb_ereg_match('/^[0-9A-Z-_\.]+$/i',$filename) === 1) ? true : false );
} }
@ -97,7 +97,7 @@ class FormUploadFiles extends Form {
* @author Sean Vieira * @author Sean Vieira
* @see http://stackoverflow.com/a/2021729 * @see http://stackoverflow.com/a/2021729
*/ */
function sanitize_file_uploaded_name($filename) { protected function sanitize_file_uploaded_name($filename) {
/* Remove anything which isn't a word, whitespace, number /* Remove anything which isn't a word, whitespace, number
* or any of the following caracters -_~,;[](). * or any of the following caracters -_~,;[]().
* If you don't need to handle multi-byte characters * If you don't need to handle multi-byte characters
@ -118,7 +118,7 @@ class FormUploadFiles extends Form {
* @author Yousef Ismaeil Cliprz. * @author Yousef Ismaeil Cliprz.
* @See http://php.net/manual/es/function.move-uploaded-file.php#111412 * @See http://php.net/manual/es/function.move-uploaded-file.php#111412
*/ */
function check_file_uploaded_length ($filename) { protected function check_file_uploaded_length ($filename) {
return (bool) ((mb_strlen($filename,'UTF-8') < 250) ? true : false); return (bool) ((mb_strlen($filename,'UTF-8') < 250) ? true : false);
} }
} }

View File

@ -16,8 +16,8 @@
/** /**
* Image files directory. * Image files directory.
*/ */
define('FILMS_DIR', dirname(RAIZ_APP).'img/films/tmp'); define('FILMS_DIR', dirname(RAIZ_APP).'/img/films/tmp');
define('FILMS_DIR_PROTECTED', RAIZ_APP.'img/films/tmp'); define('FILMS_DIR_PROTECTED', RAIZ_APP.'/img/films/tmp');
/** /**
* Allowed extensions for image files. * Allowed extensions for image files.

View File

@ -251,7 +251,7 @@ abstract class Form {
/* <<< Permite definir cadena en múltiples líneas. /* <<< Permite definir cadena en múltiples líneas.
* Revisa https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc * Revisa https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
*/ */
$htmlForm = "<form method='POST' action='{$this->action}' id='{$this->formId}{$classAtt}{$enctypeAtt}' > $htmlForm = "<form method='POST' action='{$this->action}' id='{$this->formId}'{$classAtt}{$enctypeAtt} >
<input type='hidden' name='action' value='{$this->tipoFormulario}' /> <input type='hidden' name='action' value='{$this->tipoFormulario}' />
".$tokenCSRF.$htmlCamposFormularios." ".$tokenCSRF.$htmlCamposFormularios."
</form>"; </form>";

View File

@ -19,8 +19,8 @@
<button id="avanzar">Siguiente</button> <button id="avanzar">Siguiente</button>
</section> </section>
<section class="controls"> <section class="controls">
<button id="play">Play</button> <button id="play"></button>
<button id="stop" disabled>Stop</button> <button id="stop" disabled>||</button>
</section> </section>
</div> </div>
</section> </section>