josegonzalez/upload — Issue #27: isWritable validation fail (use is_writable() without absolute path)
Author: hiryu85
Created: 2011-11-18 17:25:14+00:00
State: open

Hi, I try to use upload plugin with validation (isWritable). In development server all work, but in production this validation fail everytimes.

I see [isWritable() code](https://github.com/josegonzalez/upload/blob/master/models/behaviors/upload.php#L495) for search bug and i see that is_writable() php function have argument with non absolute path.

```php
var_dump(is_writable($this->settings[$model->alias][$field]['path']), is_writable(*APP.*$this->settings[$model->alias][$field]['path']));
```
return: __bool(false) bool(true)__

```php
return is_writable(ROOT . DS . APP_DIR . DS .$this->settings[$model->alias][$field]['path']);
```
fix this problem.

PS: prepend ROOT.DS.APP_DIR.DS to isValidDir() too.