I am on a linux server and want to do following
First Create a Directory in abc/data with name “123” so it become
abc/data/123
and then copy file edf/igk/123/aa.jpg to abc/data/123/aa.jpg
but don’t know where is problem
My Code
mkdir('abc/data/123');
copy("edf/igk/123/aa.jpg","abc/data/123/aa.jpg ");
mkdir() will only create a single directory (the one at the END of the path specification), unless you turn on its second flag:
Without that flag, the ‘abc’ and ‘abc/data’ directories MUST exist before you can create the ‘123’ directory. With the flag enabled, PHP will create any missing intermediate directories for you.
As well, since you’re using relative paths, the ‘edf’ directory must exist as a subdirectory in whatever directory is your “current working directory”. If it’s not in your cwd, then you’ll have to change you path to point to it.