PHP: fopen to create folders -


I should know that if the path is not present then there is a way to create a new folder. When I try to open a path, then it says such a file or directory does not exist I tried to open the file using 'w' and 'w +' but this new folder Not able to create. Is there any way to get it without using MCDDI () because I need to extract directory names from path to MCDIR (alone). Any help is appreciated Thanks ...

The folder can not be created.

Use something like this:

  $ filename = '/path/to/some/file.txt' $ dirname = dirname ($ filename); If (! Is_dir ($ dirname)) {mkdir ($ dirname, 0755, true); }    

Comments