0
I created a button to make the ulpoad of a file for the database. up to there beauty. but there is a problem it saves the file with the day and time instead of the file name. I wanted to know if there is a way to save this file with its own name or modify it before uploading. and would like to know how do I download it again, example: I uploaded a medical consultation, and the next appointment 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>