How to create dynamic folder in php : PHP में डायनामिक फ़ोल्डर कैसे बनाएँ

How to create dynamic folder in php

Let us tell you how to create dynamic folder in PHP named “Current year” (आइये हम आपको बताते हैं कि PHP में “Current year” नाम से डायनामिक फोल्डर कैसे बनाया जाता है).

For Example today date is “12-10-2020” (उदाहरण के लिए आज की तारीख “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

Top 20 HTML Interview Questions and Answers…

How to create dynamic folder in php

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

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