Ok so i’m writing a script that uploads a file and then publishes the file path to a mysql database. The problem i’m having is it is publish the absolute path from the root of the server. I don’t have web access to this part of the server so when my other script goes to load it, it fails.
I know the issue is with this line. Its publishing:ROOT/aaaa/aaa/aaaa/aaaa/private/modernevents/uploads/image1.jpg intead of just /private/modernevents/uploads/images1.jpg
$targetFolder = '/private/modernevents/uploads'; // Relative to the root
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
Tried to remove $_SERVER[‘DOCUMENT_ROOT’] and the script wouldn’t work anymore
Any ideas? Im lost :/
If you only want to store the path from /private/modernevents/uploads then don’t use $_SERVER[‘DOCUMENT_ROOT’]. Store $targetFolder.$imageName in the database.