I’m a n00b and I need some help figuring out this issue, I would be grateful for all the help that I can get.
So…the idea is when a user uploads for example “Abiotic Stress in Plants.pdf”, it is uploaded into a folder called “Book covers – pdf”(because of the .pdf extension) folder and has a subfolder called Abiotic Stress in Plants, which has the actual file inside.
Thank you in advance.
private function get_subdir($file_name) {
return implode('/', array_reverse(explode('.', $file_name))).'/';
}
Untested.
This should create the folders, if they don’t exist and move your file to it. Needs a bit modification, but should work I think.