I'm trying to use some dynamic path names for an image upload page. In a tutorial they had something like this:
<?PHP $directory_self = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']); // this echoes something like " /foldername/ " presumbing that the php file is set inside that folder in the root. $uploadsDirectory = $_SERVER['DOCUMENT_ROOT'] . $directory_self . 'uploaded_files/'; // this echoes something like this "C:/folder/subfolder//foldername/uploaded_files/" ?>
basicly when you put the two strings togheter to create the path, in this case for a temporary directory to store uploaded files, each string has an "/" at the end and beginning... so when you link them you get "...subfolder//foldername..."
Is there any way to force any of the above commands not to display one of the "/" or to somehow eliminate it in order for the path to be valid?