php

How to create dynamic folder in php

Spread the love

Let us tell you how to create dynamic folder in PHP named “Current year”.

For Example today date is “12-10-2020” –

<?php
$current_date = date('d-m-Y'); // get current date
$floder_name = date('Y'); // current year
$path = "upload/"; // root path
if (!is_dir($path . $floder_name)) { // checked if folder name is not exits 
	mkdir($path . $floder_name, 0777, TRUE);
	chmod($path . $floder_name, 0777);
}
?>
  • Output –
How to create dynamic folder

How to create dynamic folder in php

Leave a Reply

Your email address will not be published. Required fields are marked *