Neos.Neos/Classes/Controller/Backend/ContentController.php
public function uploadAssetAction(Asset $asset, string $metadata, NodeInterface $node, string $propertyName)
    {
        $this->response->setHeader('Content-Type', 'application/json');

        if ($metadata !== 'Asset' && $metadata !== 'Image') {
            $this->response->setStatus(400);
            $result = ['error' => 'Invalid "metadata" type: ' . $metadata];
        } else {
            if ($asset instanceof ImageInterface && $metadata === 'Image') {
                $result = $this->getImageInterfacePreviewData($asset);
            } else {
                $result = $this->getAssetProperties($asset);
            }
            if ($this->persistenceManager->isNewObject($asset)) {
                $this->assetRepository->add($asset);
            }
            $this->emitAssetUploaded($asset, $node, $propertyName);
        }
        return json_encode($result);
    }
public function uploadAssetAction(Asset $asset, string $metadata, NodeInterface $node, string $propertyName)
    {
        $this->response->setHeader('Content-Type', 'application/json');

        if ($metadata !== 'Asset' && $metadata !== 'Image') {
            $this->response->setStatus(400);
            $result = ['error' => 'Invalid "metadata" type: ' . $metadata];
        } else {
            if ($asset instanceof ImageInterface && $metadata === 'Image') {
                $result = $this->getImageInterfacePreviewData($asset);
            } else {
                $result = $this->getAssetProperties($asset);
            }
            if ($this->persistenceManager->isNewObject($asset)) {
                $this->assetRepository->add($asset);
            }
            $this->emitAssetUploaded($asset, $node, $propertyName);
        }
        return json_encode($result);
    }
public function uploadAssetAction ( Asset $ asset , string $ metadata , NodeInterface $ node , string $ propertyName ) { $ this -> response -> setHeader ( 'Content-Type' , 'application/json' ) ; if ( $ metadata !== 'Asset' && $ metadata !== 'Image' ) { $ this -> response -> setStatus ( 400 ) ; $ result = [ 'error' => 'Invalid "metadata" type: ' . $ metadata ] ; } else { if ( $ asset instanceof ImageInterface && $ metadata === 'Image' ) { $ result = $ this -> getImageInterfacePreviewData ( $ asset ) ; } else { $ result = $ this -> getAssetProperties ( $ asset ) ; } if ( $ this -> persistenceManager -> isNewObject ( $ asset ) ) { $ this -> assetRepository -> add ( $ asset ) ; } $ this -> emitAssetUploaded ( $ asset , $ node , $ propertyName ) ; } return json_encode ( $ result ) ; }
Upload a new image, and return its metadata.

Depending on the $metadata argument it will return asset metadata for the AssetEditor
or image metadata for the ImageEditor

Note: This action triggers the AssetUploaded signal that can be used to adjust the asset based on the
(site) node it was attached to.

@param Asset $asset
@param string $metadata Type of metadata to return ("Asset" or "Image")
@param NodeInterface $node The node the new asset should be assigned to
@param string $propertyName The node property name the new asset should be assigned to
@return string
Upload a new image and return its metadata .