ID:              48401
 User updated by: stefan-nowak-php at mailinator dot com
 Reported By:     stefan-nowak-php at mailinator dot com
 Status:          Open
 Bug Type:        Feature/Change Request
 PHP Version:     5.2.9
 New Comment:

User TrentTompkins provides a workaround function at:
http://php.osmirror.nl/manual/de/function.file-put-contents.php#84180

And everyone can built similar workarounds. But as originally said, it

would be nice if this feature would be included in PHP's built-in file

and directory functions.


Previous Comments:
------------------------------------------------------------------------

[2009-05-26 22:20:30] stefan-nowak-php at mailinator dot com

Description:
------------
It would be nice if all/some of PHP's file and directory functions
would 
offer a flag AUTO_CREATE_DIRS, which would then cause these functions
to 
automatically create directories for the given filepath, which yet
don't 
exist.

Many shell tools allow similar functionality (i.e: mkdir -p)

Reproduce code:
---------------
file_put_contents ( "/existing-dir/not-yet-existing-dir/file",
"test");
// Warning: file_put_contents (existing-dir/not-yet-existing-dir/file):
failed to open stream: No such file or directory



Expected result:
----------------
file_put_contents ( "/existing-dir/not-yet-existing-
dir/sub1/sub2/file.txt", "test", AUTO_CREATE_DIR);
// If my sugestion would be implemented I would then expect PHP to 
automatically create the directories:
// not-yet-existing-dir , sub1, sub2
// and the file:
// file.txt



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48401&edit=1

Reply via email to