8
I wonder if it is possible (and how I could do) I create an upload system where whenever I upload a file, it goes to a different folder (always), and show me (or record) the path it generated. It is possible to do this?
Motive: Always I send proposals in PDF that stay with 10MB, so I would like to send instead of sending to the client attachment, I send the link to him to download the proposal. However, one client cannot see another client’s proposal, so I would like to always upload to a different folder.
The code I have based on is this:
<?php
$pasta = "/pasta/onde/o/arquivo/sera/salvo";
$dest = $pasta."/".$file_name;
if(!move_uploaded_file($file, $dest)) {
echo "Não foi possível enviar o arquivo!";
} else {
echo "Arquivo enviado com sucesso!";
}
?>
Do you use a library to generate the pdf? Generally, it is necessary to specify where the file will be saved, so it would be enough to create a standard for nomenclature, but it can vary from library to library.
– NovoK
This is probably not the safest method of controlling access to files, since, even if you use non-standard names, it is possible that eventually they will be exposed...
– Jonathan dos Santos