Question About PHP mkdir

So i have this php file which writes a folder


but im stuck here because when this script is activated is just simply does not work, i tested this in localhost using xampp and it works perfect (C:\xampp\htdocs\internalfiles)

the script was supposed to writes files inside the folders (example: claimedrewards)
but its just not working.

A screenshot showing a part of your code and a few keywords as to what it’s supposed to do doesn’t tell me a lot.

What have you done to debug this already? Does the mkdir call return true? Did you try enabling display_errors and see if any error messages are displayed?

One key point to pay attention to: the mkdir call does not create directories recursively by default. So if you try to create the folder [...]/htdocs/internallfiles/claimedrewards/$id, but the folder [...]/htdocs/internallfiles/claimedrewards does not exist, the mkdir file will just fail, it won’t create the underlying directories for you.

Also, I don’t know if this is intentional or not, but there is a typo in internallfiles, notice the double l.

5 Likes

oh lol i put internallfiles, btw does creating folders via /home/vol14_2/epizy.com/epiz_33930104/htdocs/ works?

1 Like

your path is incorrect

you need to remove everything before htdocs including htdocs

image

6 Likes

It should just work. Using relative directories is recommended for portability, but using absolute paths should work as well.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.