3
I have a file upload form, so I have one input
of the kind file
:
<input type="file" class="fileinput" name="pdf"/>
Then, if a file has been selected, I want to create a folder "PDF’s". If the folder already exists I do not create, but if it does not exist I create dynamically and then upload:
if(!empty($_FILES['pdf']['tmp_name'])){
$pasta = '../pdfs/';
$ano = date('Y');
$mes = date('m');
if(!file_exists($pasta.$ano)){
mkdir($pasta.$ano,0755);
}
But I’m having a mistake with this code:
Warning: mkdir(): No such file or directory in mkdir($pasta. $ano,0755);
Why could this mistake be happening?
Thank you so much for the solution and the explanation! That’s the problem, I tried to create the folder first, and I stopped having the error!
– Mib