public function commitFile(ElementFile $file)
    {
        $filename = $file->path;

        $currentname = Media::getPathFromContent($file);
        File::resolveFilepath($currentname, null, array('base_dir' => $this->_mediadir));

        try {
            if (!is_dir(dirname($currentname))) {
                mkdir(dirname($currentname), 0755, true);
            }
            File::move($filename, $currentname);
            $file->path = Media::getPathFromContent($file);
            $this->dispatchPostUploadEvent($currentname, $file->path);
        } catch (\BackBee\Exception\BBException $e) {
            return false;
        }

        return true;
    }