View Single Post
Join Date: Oct 2008
Posts: 42
Reputation: marcmm is an unknown quantity at this point 
Solved Threads: 0
marcmm marcmm is offline Offline
Light Poster

Problem with dynamic paths

 
0
  #1
Jan 12th, 2009
I'm trying to use some dynamic path names for an image upload page. In a tutorial they had something like this:

  1. <?PHP
  2.  
  3. $directory_self = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']);
  4.  
  5. // this echoes something like " /foldername/ " presumbing that the php file is set inside that folder in the root.
  6.  
  7. $uploadsDirectory = $_SERVER['DOCUMENT_ROOT'] . $directory_self . 'uploaded_files/';
  8.  
  9. // this echoes something like this "C:/folder/subfolder//foldername/uploaded_files/"
  10.  
  11. ?>

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?
Reply With Quote