Add each element of a associative array as a file field to the form entity body.

@param array  $data
@param string $contentType
167805
public function addFiles(array $data, string $contentType = 'application/octet-stream') {
        foreach ($data as $key => $value) {
            $this->addFile($key, $value, $contentType);
        }
    }
500628
public function deletePayload($data = null, $contentType = "text/plain")
    {
        $this->addRequestHeader("Content-Type", $contentType);
        return $this->delete($data);
    }
1237044
protected function set_data(array $contents = [])
    {
        foreach ($contents as $key => $file) {
            $this->data[ $key ] = $this->add_file($file);
        }
    }
1066705
public function addPart($body, $contentType = null, $charset = null)
    {
        return $this->attach((new Swift_MimePart($body, $contentType, $charset))->setEncoder($this->getEncoder()));
    }
41617
protected function setBody($body, $contentType)
    {
        $message = $this->getSwiftMessage();
        $oldBody = $message->getBody();
        $charset = $message->getCharset();
        if (empty($oldBody)) {
            $parts = $message->getChildren();
            $partFound = false;
            foreach ($parts as $key => $part) {
                if (!($part instanceof \Swift_Mime_Attachment)) {
                    /* @var $part \Swift_Mime_MimePart */
                    if ($part->getContentType() == $contentType) {
                        $charset = $part->getCharset();
                        unset($parts[$key]);
                        $partFound = true;
                        break;
                    }
                }
            }
            if ($partFound) {
                reset($parts);
                $message->setChildren($parts);
                $message->addPart($body, $contentType, $charset);
            } else {
                $message->setBody($body, $contentType);
            }
        } else {
            $oldContentType = $message->getContentType();
            if ($oldContentType == $contentType) {
                $message->setBody($body, $contentType);
            } else {
                $message->setBody(null);
                $message->setContentType(null);
                $message->addPart($oldBody, $oldContentType, $charset);
                $message->addPart($body, $contentType, $charset);
            }
        }
    }
837028
public function addField(string $name, string $value, string $contentType = 'text/plain') {
        $this->fields[] = [$name, $value, $contentType, null];
        $this->resetCache();
    }
600493
protected function createEmbedViaData($data, $filename = null, $contentType = null)
    {
        return $this->getManager()->getDI()->get('\Swift_Image', [$data, $filename, $contentType]);
    }
1198523
protected A contentType(String contentType) {
        this.headers.add(Pair.of("Content-Type", contentType));
        return (A)this;
    }
588358
public function addFile(string $name, string $filePath, string $contentType = 'application/octet-stream') {
        $fileName = \basename($filePath);
        $this->fields[] = [$name, new FileBody($filePath), $contentType, $fileName];
        $this->isMultipart = true;
        $this->resetCache();
    }
1373377
private void setMultipart(String contentType) {
        String[] dataBoundary = HttpPostRequestDecoder.getMultipartDataBoundary(contentType);
        if (dataBoundary != null) {
            multipartDataBoundary = dataBoundary[0];
            if (dataBoundary.length > 1 && dataBoundary[1] != null) {
                charset = Charset.forName(dataBoundary[1]);
            }
        } else {
            multipartDataBoundary = null;
        }
        currentStatus = MultiPartStatus.HEADERDELIMITER;
    }
322229
private function addDocumentsFromArray(array $data)
    {
        $_documentClass = $this->_documentClass;

        $this->_result[] = $_documentClass::createFromArray($data, $this->_options);
    }
83059
public function addEmbeddedFile(string $file, string $content = null, string $contentType = null): MimePart
    {
        return $this->inlines[$file] = $this->createAttachment($file, $content, $contentType, 'inline')
            ->setHeader('Content-ID', $this->getRandomId());
    }
728541
protected function addContentTypeFieldsToForm($contentTypeFields, FormInterface $form)
    {
        /** @var FieldTypeInterface $contentTypeField */
        foreach ($contentTypeFields as $contentTypeField) {

            if (isset($this->fieldTypesConfiguration[$contentTypeField->getType()])) {
                $this->addFieldToForm($contentTypeField, $form);
            }
        }
    }
1333060
protected function doAddContentFolder($contentFolder)
    {
        parent::doAddContentFolder($contentFolder);

        $contentFolderPosition = ContentFolderQuery::create()
            ->filterByFolderId($contentFolder->getFolderId())
            ->orderByPosition(Criteria::DESC)
            ->findOne();

        $contentFolder->setPosition($contentFolderPosition !== null ? $contentFolderPosition->getPosition() + 1 : 1);
    }
668271
public function setFileBody(string $fileBody, string $contentType='')
  {
    # Clear the normal body
    $this->setBody('');

    # Set content type
    if (!empty($contentType)) {
      $this->setContentType($contentType);
    }

    # Set the filename
    $this->fileBody = $fileBody;

    return $this;
  }
1248539
private function addContentType(MenuEntry $contentRoot, $contentTypeKey, Bag $contentType)
    {
        $icon = $contentType->get('singleton') ? $contentType->get('icon_one') : $contentType->get('icon_many');

        // Named ContentType root
        $contentTypeEntry = $contentRoot->add(
            MenuEntry::create($contentTypeKey)
                ->setRoute('overview', ['contenttypeslug' => $contentTypeKey])
                ->setLabel($contentType->get('name'))
                ->setIcon($icon)
                ->setPermission('contenttype:' . $contentTypeKey)
        );
        // View
        $contentTypeEntry->add(
            MenuEntry::create('view')
                ->setRoute('overview', ['contenttypeslug' => $contentTypeKey])
                ->setLabel(Trans::__('contenttypes.generic.view', ['%contenttypes%' => $contentType->get('name')]))
                ->setIcon($contentType->get('icon_many', 'fa:files-o'))
                ->setPermission('contenttype:' . $contentTypeKey)
        );
        // New
        $contentTypeEntry->add(
            MenuEntry::create('new')
                ->setRoute('editcontent', ['contenttypeslug' => $contentTypeKey])
                ->setLabel(Trans::__('contenttypes.generic.new', ['%contenttype%' => $contentType->get('singular_name')]))
                ->setIcon('fa:plus')
                ->setPermission('contenttype:' . $contentTypeKey . ':create')
        );
    }
730637
public static void setFileData(final File file, final byte[] fileData, final String contentType) throws FrameworkException, IOException {
		FileHelper.setFileData(file, fileData, contentType, true);
	}