aivis/PHP-file-upload-class

is_writable returning NULL / false after set_destination

Closed this issue · 4 comments

Firstly i would like to say good work, this is decent script.

I was getting:
Warning: mkdir(): File exists in <dir>\upload.php on line 573
when trying to use a pre-created directory, or uploading more than once to same directory after creation.

I searched the class and found set_destination() and sub-sequentially is_writable() was being called on a relative path and returning NULL, I had to change:

ln. 558

    protected function destination_exist() {
        return is_writable($this->destination);
    }

To this:

    protected function destination_exist() {
        return is_writable($this->root . $this->destination);
    }

To get it to check the directory correctly

Thanks @crona2011 it also solved my problem...

Agreed. This should be committed.

I was just going to suggest this...