# Undefined consonant UPLOAD\_DIRECTORY

**URL:** <https://discourse.cakephp.org/t/undefined-consonant-upload-directory/7880>\
**Category:** Performance\
**Created:** [May 28, 2020, 1:02pm UTC](https://discourse.cakephp.org/t/undefined-consonant-upload-directory/7880 "2020-05-28T13:02:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![HypJ3U50N](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/hypj3u50n/32/1803_2.png) [@HypJ3U50N](https://discourse.cakephp.org/u/HypJ3U50N)\
**Post date:** [May 28, 2020, 1:02pm UTC](https://discourse.cakephp.org/t/undefined-consonant-upload-directory/7880/1 "2020-05-28T13:02:54Z")

</div>

I try to make a file input working by using the documentation:

> **[Form - 4.x](https://book.cakephp.org/4/en/views/helpers/form.html#creating-file-inputs)**
>
> The FormHelper focuses on creating forms quickly, in a way that will streamline validation, re-population and layout.

and it gives the error

> Use of undefined constant UPLOAD\_DIRECTORY - assumed ‘UPLOAD\_DIRECTORY’

I can understand that if ‘’ is assumed, this may explain the following error:

```
Argument 1 passed to Cake\Http\Session::_overwrite() must be of the type array, null given

```

I also assume the documentation is correct 🙂 although not explicetely mentioned, I used  
`use UploadedFileInterface;` in the Controller that produces the error:

public function add()  
{

```
    $gpxFile = $this->GpxFiles->newEmptyEntity();
    if ($this->request->is('post')) {
       $gpxFile = $this->GpxFiles->patchEntity($gpxFile, $this->request->getData());
		
		$gpx = $this->request->getData('gpx');
		debug($gpx);
		$destination = UPLOAD_DIRECTORY . $gpxFile->user_id . $gpx->getClientFilename();

		// Existing files with the same name will be replaced.
		$gpx->moveTo($destination);
		
		$gpxFile->name=$gpx->getClientFilename();

```

Is this a real issue or something I overlooked / what is missing in the documentation?

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [May 28, 2020, 3:00pm UTC](https://discourse.cakephp.org/t/undefined-consonant-upload-directory/7880/2 "2020-05-28T15:00:41Z")

</div>

My hunch is that `UPLOAD_DIRECTORY` is used in the documentation to indicate that it’s a constant that _you_ need to supply somewhere.
