You can get different directory paths in magento with one line code.
Mage::getBaseDir('directory_type');
where directory_type can be:
app, base, code, design, etc, lib, locale, media, skin, var, tmp, cache, log, session, upload, export
Mage::getBaseDir('app'); Mage::getBaseDir('media'); Mage::getBaseDir('skin'); ...
base: base directory where Mage.php and app folder is located. (/)
app: magento application root directory (base . app)
code: directory where magento code can be found (base . app . /code)
design: directory where magento designs can be found (base . app . /design)
etc: etc directory located on app folder (base . app. /etc)
lib: lib folder (base . /lib)
locale: locale located under app folder (base . app . /locale)
media: media folder (base . /media)
skin: skin folder (base . /skin)
var: var folder (base . /var)
tmp: (base . /var/tmp)
cache: (base . /var/cache)
log: (base . /var/log)
session: (base . /var/session)
export: (base . /var/export)
upload: (base . /media/upload)
Source: Mage.php and app\code\core\Mage\Core\Model\Config\Options.php