Add files via upload

This commit is contained in:
Fernando Méndez
2021-05-23 16:23:25 +02:00
committed by GitHub
parent ae8ac3c07a
commit 27c3ee739c
16 changed files with 330 additions and 38 deletions

View File

@ -22,9 +22,10 @@ class FormUploadFiles extends Form {
// Se genera el HTML asociado a los campos del formulario y los mensajes de error.
$html = '
<p><label for="archivo">Imagen:</label><input type="file" name="archivo" id="archivo" /></p><pre>'.$htmlErroresGlobales.'</pre>
<p><input type="submit" id="submit" value="Subir" class="primary" /><pre>'.$errorFile.'</pre>
'.$dats.'
<div class="file">
<label for="file">Imagen:</label><input type="file" name="file" id="file" /><pre>'.$htmlErroresGlobales.'</pre>
</div>
<input type="submit" id="submit" value="Subir" class="primary" /><pre>'.$errorFile.'</pre>
';
return $html;
@ -64,7 +65,7 @@ class FormUploadFiles extends Form {
}
// 4. Si fuese necesario guardar en la base de datos la ruta relativa $nombre del archivo
return "index.php#img=".urlencode('img/'.$nombre);
//return "index.php#img=".urlencode('img/'.$nombre);
} else {
$result["errorFile"] = 'El archivo tiene un nombre o tipo no soportado';
}