/** * Get the File object for the given $name. * If you have a multi-dimensional upload field name, than you should pass the optional $arrayOffset param to get the * right File object. * * @param string $name Name of the upload field. * @param null|int $arrayOffset Optional array offset for multi-dimensional upload fields. * * @throws \Exception|Request\Files\FilesException * @return Files\File */ public function files($name, $arrayOffset = null) { try { return $this->files->get($name, $arrayOffset); } catch (Files\FilesException $e) { throw $e; } }
public function testGetSize() { $files = new Files(); $testFile = $files->get("test_file"); $this->assertSame("2048", $testFile->getSize()); }
/** * @expectedException \Webiny\Component\Http\Request\Files\FilesException */ public function testGetException() { $files = new Files(); $files->get("doesnt_exit"); }