Showing posts with label read directory php. Show all posts
Showing posts with label read directory php. Show all posts
create directory in php
create directory in php
Now we are going to create directory that is folder in php.In the PHP we are having mkdir()to create directory.
Program
OutputNow we are going to create directory that is folder in php.In the PHP we are having mkdir()to create directory.
Program
<?php // create a new directory path mkdir("C:\wamp\www\uploaddata1"); if(mkdir) { echo "directory created"; } else { echo "directory can't created"; } ?> |

In this program we are create directory called uploaddata will created .
read directory php
read directory php
Output:
index.html
est.html
first.php
Explanation
Now opendir simply opens a directory,replace folder with the name of the folder and if needed, the path too.The while loop then goes through file by file in the directory .the if statement exclude s showing two non-files.you can exclude any files you wish too.After a simpl e echo displaying the filename
| <?php // assign folder into variable $currdir='/var/www'; //open the directory for reading $dir=opendir($currdir); //read a filename while($file = readdir($dir) { // Display all file name in the specified folder echo "$file<br/>"; } closedir($dir); }?> |
index.html
est.html
first.php
Explanation
Now opendir simply opens a directory,replace folder with the name of the folder and if needed, the path too.The while loop then goes through file by file in the directory .the if statement exclude s showing two non-files.you can exclude any files you wish too.After a simpl e echo displaying the filename
Subscribe to:
Posts (Atom)





