// Move the file to the correct location after validation. Use
// FileSystemInterface::EXISTS_ERROR as the file location has already been
// determined above in FileSystem::getDestinationFilename().
try { $this->fileSystem->
move($temp_file_path,
$file_uri, FileSystemInterface::EXISTS_ERROR
);
} catch (FileException
$e) { throw new HttpException(500, 'Temporary file could not be moved to file location'
);
} // Second step of the validation on the file object itself now.
$this->
resourceValidate($file);
$file->
save();
$this->lock->
release($lock_id);
// 201 Created responses return the newly created entity in the response
// body. These responses are not cacheable, so we add no cacheability
// metadata here.
return new ModifiedResourceResponse($file, 201
);
}