file upload - Can I change current directory to parent directory using PHP __DIR__ constant? -


i using php magic constant move uploaded file new location, , upload handler file location inside "_inc" file inside main application folder this:

"path/tasksapp/_inc/upload_handelr.php"

so; when use __dir__ path upload hander exist:

"path/tasksapp/_inc/"

while new location uploaded file should be:

"path/tasksapp/uploads"

is there's option or attribute can use __dir__ constant can change current directory parent directory:

change:

"path/tasksapp/_inc/"

to be:

"path/tasksapp/"

i recommend dirname(__dir__):

  • it's portable (works on windows a/b/../c not allowed)
  • it's readable

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -