I created a button to make the ulpoad of a file for the database. even beauty but has a problem it saves the file with the day and time instead of the file name. was wondering if there is a way to save this file with its own name or modify it before uploading. and I would like to know how to lower it again, eg: I uploaded a medical consultation, and in the next query I would like to download it.
<?phpif(isset($_FILES['fileUpload'])){
date_default_timezone_set("Brazil/East"); //Definindo timezone padrão
$ext = strtolower(substr($_FILES['fileUpload']['name'],-4)); //Pegando extensão do arquivo
$new_name = date("Y.m.d-H.i.s") . $ext; //Definindo um novo nome para o arquivo
$dir = 'uploads/'; //Diretório para uploads
move_uploaded_file($_FILES['fileUpload']['tmp_name'], $dir.$new_name); //Fazer upload do arquivo}?>
<form action="#" method="POST" enctype="multipart/form-data">
<input type="file" name="fileUpload">
<input type="submit" value="Enviar">
</form>