/** * @param waRequestFile $f * @return bool */ protected function processFile($f) { if ($f->uploaded()) { if (!$this->isValid($f)) { return false; } if (!$this->save($f)) { $this->errors[] = sprintf(_w('Failed to upload file %s.'), $f->name); return false; } return true; } else { $this->errors[] = sprintf(_w('Failed to upload file %s.'), $f->name) . ' (' . $f->error . ')'; return false; } }
/** * @param waRequestFile $f * @param string $path * @param string $error * @return bool */ protected function uploadImage(waRequestFile $f, $path, &$error = '') { if ($f->uploaded()) { if (!$this->isImageValid($f, $error)) { return false; } $path = str_replace('*', $f->extension, $path); if (!$f->moveTo($path)) { $error = sprintf(_w('Failed to upload file %s.'), $f->name); return false; } return true; } else { if ($f->name) { $error = sprintf(_w('Failed to upload file %s.'), $f->name) . ' (' . $f->error . ')'; } return false; } }
/** * @param waRequestFile $f * @param string $path * @param string $name * @param array $errors * @return bool */ protected function processFile(waRequestFile $f, $path, &$name, &$errors = array()) { if ($f->uploaded()) { if (!$this->isFileValid($f, $errors)) { return false; } if (!$this->saveFile($f, $path, $name)) { $errors[] = sprintf(_w('Failed to upload file %s.'), $f->name); return false; } return true; } else { $errors[] = sprintf(_w('Failed to upload file %s.'), $f->name) . ' (' . $f->error . ')'; return false; } }