public function storeFile($input = null, $target)
    {
        // The input name and target path must be defined
        if (!isset($input) || !isset($target)) {
            throw new \InvalidArgumentException('Undefined input name or target', 400);
        }

        // Move the uploaded file
        $result = move_uploaded_file($_FILES[$input]['tmp_name'], $target);

        // Check if the file was stored
        if (!$result) {
            throw new \InvalidArgumentException('The file could not be stored', 500);
        }

        // Return the file info
        return $result;
    }
public function storeFile($input = null, $target)
    {
        // The input name and target path must be defined
        if (!isset($input) || !isset($target)) {
            throw new \InvalidArgumentException('Undefined input name or target', 400);
        }

        // Move the uploaded file
        $result = move_uploaded_file($_FILES[$input]['tmp_name'], $target);

        // Check if the file was stored
        if (!$result) {
            throw new \InvalidArgumentException('The file could not be stored', 500);
        }

        // Return the file info
        return $result;
    }
public function storeFile ( $ input = null , $ target ) { // The input name and target path must be defined if ( ! isset ( $ input ) || ! isset ( $ target ) ) { throw new \ InvalidArgumentException ( 'Undefined input name or target' , 400 ) ; } // Move the uploaded file $ result = move_uploaded_file ( $ _FILES [ $ input ] [ 'tmp_name' ] , $ target ) ; // Check if the file was stored if ( ! $ result ) { throw new \ InvalidArgumentException ( 'The file could not be stored' , 500 ) ; } // Return the file info return $ result ; }
Stores a request file

@param string $input Input key
@param string $target Target path
@return boolean Success or fail of the store operation
Stores a request file