In `IUploadFileValidationStrategy::validate()`, you now get proper
values for `UploadFile::getImageData()`, for example.
$fileLocation = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$package->packageDir)).$option->filelocation.'.'.$file->getFileExtension();
// save file
- move_uploaded_file($file->getLocation(), $fileLocation);
+ $file->moveUploadedFile($fileLocation);
// return file location as the value to store in the database
return $fileLocation;
return null;
}
+
+ /**
+ * Moves the uploaded file to the given location and updates the internal location value to the new location
+ * and the internal filename value to the new filename derived from the given location.
+ *
+ * @param string $newLocation new file location
+ */
+ public function moveUploadedFile($newLocation) {
+ move_uploaded_file($this->location, $newLocation);
+
+ $this->location = $newLocation;
+ $this->filename = basename($this->location);
+ }
}