upload($to, $params = array())

Shortcut for the Upload class

  • $to (string)
    Destination path
  • $params (array)
    Additional options
  • return ($upload)

Example

// Uses the file from the input field with `name="file"`
$upload = upload(__DIR__ . DS . '{{safeName}}.jpg');

// Uses the file from the input field with `name="image"`
$upload = upload(__DIR__ . DS . '{{safeName}}.jpg', array('input' => 'image'));