product-attachments-magento2
product-attachments-magento2 copied to clipboard
External script
Hello, how can i use this module from an external script in php?
Thank you
if I use this code $sampleContent = $objectManager->create(\Magento\Downloadable\Api\Data\File\ContentInterfaceFactory::class)->create(); $sampleContent->setFileData( @codingStandardsIgnoreLine base64_encode(file_get_contents( '/var/www/html/jellyfish_1_3.pdf')) ); $sampleContent->setName('jellyfish_1_3.pdf'); $sampleContent->setType('application/octet-stream');
$upload =$objectManager->create(LizardMedia\ProductAttachment\Api\Data\File\ContentUploaderInterface::class); $upload->upload($sampleContent,"file");
I get the following error: PHP Fatal error: Uncaught Magento\Framework\Exception\RuntimeException: Type Error occurred when creating object: Magento\MediaGalleryIntegration\Plugin\SaveImageInformation, Argument 6 passed to Magento\MediaGalleryIntegration\Plugin\SaveImageInformation::__construct() must be of the type array, null given, called in /vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121 in /vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:131
What can I do?