brandonsavage / Upload

File uploads with validation and storage strategies
MIT License
1.67k stars 315 forks source link

The ability to get the current directory in the fileinfo object #78

Closed G4MR closed 8 years ago

G4MR commented 8 years ago

Should be a simple tweak, i'll put in a PR later:

public function __construct($filePathname, $newName = null)
{
    $desiredName = is_null($newName) ? $filePathname : $newName;
    $this->name = pathinfo($desiredName, PATHINFO_FILENAME);
    $this->directory = pathinfo($desiredName, PATHINFO_DIRNAME);
    $this->extension = strtolower(pathinfo($desiredName, PATHINFO_EXTENSION));
    parent::__construct($filePathname);
}

/**
 * Get directory path of the current file
 *
 * @return string
 */
public function getDirectory()
{
    return $this->directory;
}
G4MR commented 8 years ago

Edit just realized FileInfo doesn't even exist anymore.