src/Jaspersoft/Service/RepositoryService.php
public function createFileResource(File $resource, $binaryData, $parentFolder, $createFolders = true)
    {
        $url = self::makeUrl(null, $parentFolder);

        $url .= '?' . Util::query_suffix(array("createFolders" => $createFolders));
        $body = $binaryData;
        $response = $this->service->sendBinary($url, array(201, 200), $body, MimeMapper::mapType($resource->type), 'attachment; filename=' . $resource->label, $resource->description, 'POST');
        return File::createFromJSON(json_decode($response, true), get_class($resource));
    }
public function createFileResource(File $resource, $binaryData, $parentFolder, $createFolders = true)
    {
        $url = self::makeUrl(null, $parentFolder);

        $url .= '?' . Util::query_suffix(array("createFolders" => $createFolders));
        $body = $binaryData;
        $response = $this->service->sendBinary($url, array(201, 200), $body, MimeMapper::mapType($resource->type), 'attachment; filename=' . $resource->label, $resource->description, 'POST');
        return File::createFromJSON(json_decode($response, true), get_class($resource));
    }
public function createFileResource ( File $ resource , $ binaryData , $ parentFolder , $ createFolders = true ) { $ url = self :: makeUrl ( null , $ parentFolder ) ; $ url .= '?' . Util :: query_suffix ( array ( "createFolders" => $ createFolders ) ) ; $ body = $ binaryData ; $ response = $ this -> service -> sendBinary ( $ url , array ( 201 , 200 ) , $ body , MimeMapper :: mapType ( $ resource -> type ) , 'attachment; filename=' . $ resource -> label , $ resource -> description , 'POST' ) ; return File :: createFromJSON ( json_decode ( $ response , true ) , get_class ( $ resource ) ) ; }
Create a file on the server by supplying binary data

If you are using a custom MIME type, you must add the type => mimeType mapping
to the \Jaspersoft\Tool\MimeMapper mimeMap.

@param \Jaspersoft\Dto\Resource\File $resource
@param string $binaryData
@param string $parentFolder string The folder to place the file in
@param boolean $createFolders
@return \Jaspersoft\Dto\Resource\File
Create a file on the server by supplying binary data