mbmsit
mbmsit

Reputation: 63

php copy file with its path

in php: how to copy a file existng in 1/2/3 directory to folder 0 , but if the nested folders 1/2/3 are not exist in 0, it should create that folders (1 and 2 and 3), then copy the file into. thanks.

Upvotes: 0

Views: 1135

Answers (1)

Pentium10
Pentium10

Reputation: 208042

You need to call mkdir with the recursive flag before runing the copy

mkdir("/path/to/my/dir", 0700,true);

Upvotes: 1

Related Questions