I am using PHP to upload files onto my web server from a subdomain.
my subdomain is admin.domain.com
which is located in the directory admin before the public_html
directory (i am using cPanel)
i want to be able to upload files into the admin
directory which is up a level from the public_html directory from admin.domain.com
and also from just domain.com
what path names will i need to use to do this?
$uploadPath = realpath( __DIR__ . '/..' );
set your path in a variable and use move_uploaded_file()
to move your file in desired location every time you upload any file.
If I understood correctly, your files are in the same server, in the same file structure, just being seen through differents domains. If yes, then what you need to check is:
1 - The path for the admin directoy, for example: F:/wamp/www/php/super-variables/test-$_server.php
For that, you can throw a php file with <?php echo ["SCRIPT_FILENAME"]; ?>
in the folder. It will return the path for that folder.
2 - Check if you have permission to upload files in that folder:
For that, It will depend on how much permission you have in your server. I use the Filezilla FTP to do that.