public function addFile($file, $name = null, $mime = null) {

		if('post' !== $this -> method) {
			return trigger_error('File uploads are only supported with POST request method', E_USER_ERROR);
		}

		if(false === $file instanceof File && false === is_string($file)) {
            return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or instance of sFire\\System\\File, "%s" given', __METHOD__, gettype($file)), E_USER_ERROR);
        }

        if(null !== $name && false === is_string($name)) {
            return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($name)), E_USER_ERROR);
        }

		if(null !== $mime && false === is_string($mime)) {
			return trigger_error(sprintf('Argument 3 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($mime)), E_USER_ERROR);
		}

		if(true === is_string($file)) {
			$file = new File($file);
		}

		if(false === $file -> isReadable()) {
			return trigger_error(sprintf('File %s passed to %s() is not readable', $file -> entity() -> getBasepath(), __METHOD__), E_USER_ERROR);
		}

		if(null === $name) {
			$name = $file -> entity() -> getBasename();
		}

		if(null === $mime) {
			$mime = $file -> getMime();
		}

		$this -> files[] = (object) ['file' => $file, 'name' => $name, 'mime' => $mime];

		return $this;
	}
public function addFile($file, $name = null, $mime = null) {

		if('post' !== $this -> method) {
			return trigger_error('File uploads are only supported with POST request method', E_USER_ERROR);
		}

		if(false === $file instanceof File && false === is_string($file)) {
            return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or instance of sFire\\System\\File, "%s" given', __METHOD__, gettype($file)), E_USER_ERROR);
        }

        if(null !== $name && false === is_string($name)) {
            return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($name)), E_USER_ERROR);
        }

		if(null !== $mime && false === is_string($mime)) {
			return trigger_error(sprintf('Argument 3 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($mime)), E_USER_ERROR);
		}

		if(true === is_string($file)) {
			$file = new File($file);
		}

		if(false === $file -> isReadable()) {
			return trigger_error(sprintf('File %s passed to %s() is not readable', $file -> entity() -> getBasepath(), __METHOD__), E_USER_ERROR);
		}

		if(null === $name) {
			$name = $file -> entity() -> getBasename();
		}

		if(null === $mime) {
			$mime = $file -> getMime();
		}

		$this -> files[] = (object) ['file' => $file, 'name' => $name, 'mime' => $mime];

		return $this;
	}
public function addFile ( $ file , $ name = null , $ mime = null ) { if ( 'post' !== $ this -> method ) { return trigger_error ( 'File uploads are only supported with POST request method' , E_USER_ERROR ) ; } if ( false === $ file instanceof File && false === is_string ( $ file ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string or instance of sFire\\System\\File, "%s" given' , __METHOD__ , gettype ( $ file ) ) , E_USER_ERROR ) ; } if ( null !== $ name && false === is_string ( $ name ) ) { return trigger_error ( sprintf ( 'Argument 2 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ name ) ) , E_USER_ERROR ) ; } if ( null !== $ mime && false === is_string ( $ mime ) ) { return trigger_error ( sprintf ( 'Argument 3 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ mime ) ) , E_USER_ERROR ) ; } if ( true === is_string ( $ file ) ) { $ file = new File ( $ file ) ; } if ( false === $ file -> isReadable ( ) ) { return trigger_error ( sprintf ( 'File %s passed to %s() is not readable' , $ file -> entity ( ) -> getBasepath ( ) , __METHOD__ ) , E_USER_ERROR ) ; } if ( null === $ name ) { $ name = $ file -> entity ( ) -> getBasename ( ) ; } if ( null === $ mime ) { $ mime = $ file -> getMime ( ) ; } $ this -> files [ ] = ( object ) [ 'file' => $ file , 'name' => $ name , 'mime' => $ mime ] ; return $ this ; }
Attach file to request
@param $file string|sFire\System\File
@param $name string
@param $string mime
@return sFire\HTTP\Client
Attach file to request