@ginerjm
Uhh, I'm not quite sure that my MyProject (singular, not plural by the way) folder is under the "true html root folder," because I'm not sure what that means.
For context anyway, I run Manjaro Linux (apparently based on Arch Linux), and since I'm using a lot of php, I had to download xampp and all my files have to be based out of its folder. So basically, the file I'm in right now (named addimg.php) is at location:
/opt/lampp/htdocs/MyProject/scripts/addimg.php
where / is the home folder. Like, when I go to just "/" on my file explorer, it just says that it's my internal hard drive.
The fact that I run Linux also means I can't use backslashes (\). Always has to be forward slashes.
Anyway, I will have to host this on an external server later, so I can't depend on the files on my computer not related to my project. Everytime I refer to another file, I always have to move within the MyProject folder. That is, I can't use the actual file location of /op/lampp... because it would just break my code when I run it on the server.
Hoping that was fine, I did the following:
$_SERVER['DOCUMENT_ROOT'] = '/MyProject';
fileDestination = $_SERVER['DOCUMENT_ROOT']."/uploads/".$fileNameNew;
move_uploaded_file($fileTmpName, $fileDestination);
(I also tried $_SERVER['DOCUMENT_ROOT'] . '/MyProject'; by the way)
The "/uploads/" part turns red for some reason, but I don't get an error and it runs. But, even though it runs without error, it doesn't work. My uploads folder is still empty
I hope that maybe my more in-depth explanation of my device and project file structure gives you any other context that you may have been missing, and you'd be able to help me out. This is my third day of being stuck on this problem, and I have no one around me to turn to for help.
Please let me know if you have any other suggestions. If you don't, please inform me of that as well. I'd rather know if I should just give up, than continuously refresh this page hoping for a reply...
Thanks.