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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -