Skip to main content
Version: Fegg 5.x

Upload::setUploadDir

Set the upload directory

Description​

public boolean Upload::setUploadDir( string $dir )

The directory is created (recursively, mode 0755) when it does not exist. Returns true when the directory is writable, otherwise false and the directory is not set.

When the directory is below the document root and has no .htaccess, Upload::HTACCESS is written there: it serves only the file types that can be uploaded and runs no script (see Introduction). An existing .htaccess is left alone.

Arguments​

NameData typeDefaultRemarks
$dirstringUpload directory

Example​

Controller
use Fegg\Tool\Upload;

$upload = new Upload();
$upload->setUploadDir($this->config['upload_dir']['path']);