Remove files and folder in PHP

Advertisemen

Let's say you have folder like this in your server.
   >> Uploads
          >> Images
             >> img1.png
             >> img2.png
             >> img3.png
in other way Uploads / Images / img1.png........

You can send a command like this rmdir(directory) but this works only if the folder doesn't have anything inside. So what to do?
First we have to unlink every thing inside that directory, like this
array_map("unlink", glob("Uploads"."*.*"));
Then call
rmdir("Uploads");
This should do the magic.
Thanks.....


Advertisemen

Disclaimer: Gambar, artikel ataupun video yang ada di web ini terkadang berasal dari berbagai sumber media lain. Hak Cipta sepenuhnya dipegang oleh sumber tersebut. Jika ada masalah terkait hal ini, Anda dapat menghubungi kami disini.

Tidak ada komentar:

Posting Komentar

© Copyright 2017 Tutorial Unity 3D