$this->data['packageVersion'] = $packageVersion;
}
+ /**
+ * Returns the absolute path to the package directory with a trailing slash.
+ *
+ * @return string
+ */
+ public function getAbsolutePackageDir() {
+ return FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $this->packageDir));
+ }
+
/**
* Loads package requirements.
*/
}
// determine location the file will be stored at
- $package = PackageCache::getInstance()->getPackage($option->packageID);
- $fileLocation = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$package->packageDir)).$option->filelocation.'.'.$file->getFileExtension();
+ $relativeFileLocation = $option->filelocation . '.' . $file->getFileExtension();
+
+ $fileLocation = PackageCache::getInstance()->getPackage($option->packageID)->getAbsolutePackageDir() . $relativeFileLocation;
// save file
$file->moveUploadedFile($fileLocation);
- // return file location as the value to store in the database
- return $fileLocation;
+ // return relative file location as the value to store in the database
+ return $relativeFileLocation;
}
/**