{"id":145477,"date":"2018-09-28T12:12:27","date_gmt":"2018-09-28T12:12:27","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=145477"},"modified":"2026-01-15T13:19:52","modified_gmt":"2026-01-15T13:19:52","slug":"create-and-manage-product-file-type-attribute-in-magento-2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/","title":{"rendered":"Create Product File Type Attribute in Magento 2"},"content":{"rendered":"\n<p>In this blog, we\u2019ll explain how to Create Product File Type Attribute in Magento 2, covering setup steps and practical use cases for file uploads.<\/p>\n\n\n\n<p>Follow the below steps in order to create file type attribute:<\/p>\n\n\n\n<p><strong>Step 1:<\/strong><\/p>\n\n\n\n<p>First of all we have to create a product attribute with input type &#8220;File&#8221;. Here I&#8217;m creating it by installer. So, create a InstallData.php file in \/app\/code\/Vendor\/Module\/Setup directory and copy below code.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nnamespace Vendor\\Module\\Setup;\n\nuse Magento\\Eav\\Setup\\EavSetupFactory;\nuse Magento\\Framework\\Setup\\InstallDataInterface;\nuse Magento\\Framework\\Setup\\ModuleContextInterface;\nuse Magento\\Framework\\Setup\\ModuleDataSetupInterface;\nuse Magento\\Eav\\Model\\Entity\\Attribute\\Set as AttributeSet;\nuse Magento\\Catalog\\Model\\ResourceModel\\Product as ResourceProduct;\n\nclass InstallData implements InstallDataInterface\n{\n    protected $_attributeSet;\n    protected $_eavSetupFactory;\n    protected $_resourceProduct;\n \n    public function __construct(\n        AttributeSet $attributeSet,\n        EavSetupFactory $eavSetupFactory,\n        ResourceProduct $resourceProduct\n    ) {\n        $this-&gt;_attributeSet    = $attributeSet;\n        $this-&gt;_eavSetupFactory = $eavSetupFactory;\n        $this-&gt;_resourceProduct = $resourceProduct;\n    }\n\n    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) {\n        $eavSetup = $this-&gt;_eavSetupFactory-&gt;create(&#091;&quot;setup&quot;=&gt;$setup]);\n        $eavSetup-&gt;addAttribute(\n            \\Magento\\Catalog\\Model\\Product::ENTITY,\n            &#039;agreement_file&#039;,\n            &#091;\n                &#039;type&#039; =&gt; &#039;varchar&#039;,\n                &#039;label&#039; =&gt; &#039;Agreement File&#039;,\n                &#039;input&#039; =&gt; &#039;file&#039;,\n                &#039;backend&#039; =&gt; &#039;Vendor\\Module\\Model\\Product\\Attribute\\Backend\\File&#039;,\n                &#039;frontend&#039; =&gt; &#039;&#039;,\n                &#039;class&#039; =&gt; &#039;&#039;,\n                &#039;source&#039; =&gt; &#039;&#039;,\n                &#039;global&#039; =&gt; \\Magento\\Eav\\Model\\Entity\\Attribute\\ScopedAttributeInterface::SCOPE_GLOBAL,\n                &#039;visible&#039; =&gt; true,\n                &#039;required&#039; =&gt; false,\n                &#039;user_defined&#039; =&gt; true,\n                &#039;default&#039; =&gt; &#039;&#039;,\n                &#039;searchable&#039; =&gt; false,\n                &#039;filterable&#039; =&gt; false,\n                &#039;comparable&#039; =&gt; false,\n                &#039;visible_on_front&#039; =&gt; false,\n                &#039;unique&#039; =&gt; false,\n                &#039;apply_to&#039; =&gt; &#039;simple,configurable&#039;, \/\/ applicable for simple and configurable product \n                &#039;used_in_product_listing&#039; =&gt; false\n            ]\n        );\n\n        \/\/ assign attribute to attribute set\n        $entityType = $this-&gt;_resourceProduct-&gt;getEntityType();\n        $attributeSetCollection = $this-&gt;_attributeSet-&gt;setEntityTypeFilter($entityType);\n        foreach ($attributeSetCollection as $attributeSet) {\n            $eavSetup-&gt;addAttributeToSet(&quot;catalog_product&quot;, $attributeSet-&gt;getAttributeSetName(), &quot;General&quot;, &quot;agreement_file&quot;);\n        }\n    }\n}<\/pre>\n\n\n\n<p><strong>Step 2:<\/strong><\/p>\n\n\n\n<p>Then create backend model File.php(which we have defined in attribute options) in app\/code\/Vendor\/Module\/Model\/Product\/Attribute\/Backend directory and copy below code.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nnamespace Vendor\\Module\\Model\\Product\\Attribute\\Backend;\n\nuse Magento\\Framework\\App\\Filesystem\\DirectoryList;\n\nclass File extends \\Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\AbstractBackend\n{\n    \/**\n     * @var \\Magento\\Framework\\Filesystem\\Driver\\File\n     *\/\n    protected $_file;\n\n    \/**\n     * @var \\Psr\\Log\\LoggerInterface\n     *\/\n    protected $_logger;\n\n    \/**\n     * @var \\Magento\\Framework\\Filesystem\n     *\/\n    protected $_filesystem;\n\n    \/**\n     * @var \\Magento\\MediaStorage\\Model\\File\\UploaderFactory\n     *\/\n    protected $_fileUploaderFactory;\n    \n\n    \/**\n     * Construct\n     *\n     * @param \\Psr\\Log\\LoggerInterface $logger\n     * @param \\Magento\\Framework\\Filesystem $filesystem\n     * @param \\Magento\\MediaStorage\\Model\\File\\UploaderFactory $fileUploaderFactory\n     *\/\n    public function __construct(\n        \\Psr\\Log\\LoggerInterface $logger,\n        \\Magento\\Framework\\Filesystem $filesystem,\n        \\Magento\\Framework\\Filesystem\\Driver\\File $file,\n        \\Magento\\MediaStorage\\Model\\File\\UploaderFactory $fileUploaderFactory\n    ) {\n        $this-&gt;_file = $file;\n        $this-&gt;_filesystem = $filesystem;\n        $this-&gt;_fileUploaderFactory = $fileUploaderFactory;\n        $this-&gt;_logger = $logger;\n    }\n\n    public function afterSave($object)\n    {\n        $path = $this-&gt;_filesystem-&gt;getDirectoryRead(\n            DirectoryList::MEDIA\n        )-&gt;getAbsolutePath(\n            &#039;catalog\/product\/file\/&#039;\n        );\n        $delete = $object-&gt;getData($this-&gt;getAttribute()-&gt;getName() . &#039;_delete&#039;);\n\n        if ($delete) {\n            $fileName = $object-&gt;getData($this-&gt;getAttribute()-&gt;getName());\n            $object-&gt;setData($this-&gt;getAttribute()-&gt;getName(), &#039;&#039;);\n            $this-&gt;getAttribute()-&gt;getEntity()-&gt;saveAttribute($object, $this-&gt;getAttribute()-&gt;getName());\n            if ($this-&gt;_file-&gt;isExists($path.$fileName))  {\n                $this-&gt;_file-&gt;deleteFile($path.$fileName);\n            }\n        }\n\n        if (empty($_FILES)) {\n            return $this;\/\/ if no image is set then nothing to do\n        }\n\n        try {\n            \/** @var $uploader \\Magento\\MediaStorage\\Model\\File\\Uploader *\/\n            $uploader = $this-&gt;_fileUploaderFactory-&gt;create(&#091;&#039;fileId&#039; =&gt; &#039;product&#091;&#039;.$this-&gt;getAttribute()-&gt;getName().&#039;]&#039;]);\n            $uploader-&gt;setAllowedExtensions(&#091;&#039;pdf&#039;]);\n            $uploader-&gt;setAllowRenameFiles(true);\n            $result = $uploader-&gt;save($path);\n            $object-&gt;setData($this-&gt;getAttribute()-&gt;getName(), $result&#091;&#039;file&#039;]);\n            $this-&gt;getAttribute()-&gt;getEntity()-&gt;saveAttribute($object, $this-&gt;getAttribute()-&gt;getName());\n        } catch (\\Exception $e) {\n            if ($e-&gt;getCode() != \\Magento\\MediaStorage\\Model\\File\\Uploader::TMP_NAME_EMPTY) {\n                $this-&gt;_logger-&gt;critical($e);\n            }\n        }\n        \n        return $this;\n    }\n}<\/pre>\n\n\n\n<p><strong>Step 3:<\/strong><\/p>\n\n\n\n<p>To display saved file, we need to define template for the attribute. So, first define modifier class of the attribute in app\/code\/Vendor\/Module\/etc\/adminhtml\/di.xml as mentioned below<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&gt;\n&lt;config xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:ObjectManager\/etc\/config.xsd&quot;&gt;\n    &lt;virtualType name=&quot;Magento\\Catalog\\Ui\\DataProvider\\Product\\Form\\Modifier\\Pool&quot;&gt;\n        &lt;arguments&gt;\n            &lt;argument name=&quot;modifiers&quot; xsi:type=&quot;array&quot;&gt;\n                &lt;item name=&quot;agreement_file&quot; xsi:type=&quot;array&quot;&gt;\n                    &lt;item name=&quot;class&quot; xsi:type=&quot;string&quot;&gt;Vendor\\Module\\Ui\\DataProvider\\Product\\Form\\Modifier\\File&lt;\/item&gt;\n                    &lt;item name=&quot;sortOrder&quot; xsi:type=&quot;number&quot;&gt;10&lt;\/item&gt;\n                &lt;\/item&gt;\n            &lt;\/argument&gt;\n        &lt;\/arguments&gt;\n    &lt;\/virtualType&gt;\n&lt;\/config&gt;<\/pre>\n\n\n\n<p><strong>Step 4:<\/strong><\/p>\n\n\n\n<p>Create modifier class File.php in app\/code\/Vendor\/Module\/Ui\/DataProvider\/Product\/Form\/Modifier directory and copy below code<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nnamespace Vendor\\Module\\Ui\\DataProvider\\Product\\Form\\Modifier;\n\nuse Magento\\Framework\\Stdlib\\ArrayManager;\nuse Magento\\Catalog\\Ui\\DataProvider\\Product\\Form\\Modifier\\AbstractModifier;\n\nclass File extends AbstractModifier\n{\n    \/**\n     * @var Magento\\Framework\\Stdlib\\ArrayManager\n     *\/\n    protected $arrayManager;\n\n    \/**\n     * @param ArrayManager                $arrayManager\n     *\/\n    public function __construct(\n        ArrayManager $arrayManager\n    ) {\n        $this-&gt;arrayManager = $arrayManager;\n    }\n\n    public function modifyMeta(array $meta)\n    {\n        $fieldCode = &#039;agreement_file&#039;;\n        $elementPath = $this-&gt;arrayManager-&gt;findPath($fieldCode, $meta, null, &#039;children&#039;);\n        $containerPath = $this-&gt;arrayManager-&gt;findPath(static::CONTAINER_PREFIX . $fieldCode, $meta, null, &#039;children&#039;);\n\n        if (!$elementPath) {\n            return $meta;\n        }\n\n        $meta = $this-&gt;arrayManager-&gt;merge(\n            $containerPath,\n            $meta,\n            &#091;\n                &#039;children&#039;  =&gt; &#091;\n                    $fieldCode =&gt; &#091;\n                        &#039;arguments&#039; =&gt; &#091;\n                            &#039;data&#039; =&gt; &#091;\n                                &#039;config&#039; =&gt; &#091;\n                                    &#039;elementTmpl&#039;   =&gt; &#039;Vendor_Module\/elements\/file&#039;,\n                                ],\n                            ],\n                        ],\n                    ]\n                ]\n            ]\n        );\n        return $meta;\n    }\n\n    \/**\n     * {@inheritdoc}\n     *\/\n    public function modifyData(array $data)\n    {\n        return $data;\n    }\n}<\/pre>\n\n\n\n<p><strong>Step 5:<\/strong><\/p>\n\n\n\n<p>At last create template file file.html in \/app\/code\/Vendor\/Module\/view\/adminhtml\/web\/template\/elements directory and write below code<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;input class=&quot;admin__control-file&quot; type=&quot;file&quot; data-bind=&quot;\n    hasFocus: focused,\n    attr: {\n        name: inputName,\n        placeholder: placeholder,\n        &#039;aria-describedby&#039;: noticeId,\n        id: uid,\n        disabled: disabled,\n        form: formId\n    }&quot;\n\/&gt;\n&lt;!-- ko if: $parent.source.data.product&#091;code] --&gt;\n&lt;span&gt;\n    &lt;a attr=&quot;href: &#039;\/pub\/media\/catalog\/product\/file\/&#039;+$parent.source.data.product&#091;code]&quot; text=&quot;$parent.source.data.product&#091;code]&quot;&gt;&lt;\/a&gt;\n    &lt;label attr=&quot;for: uid+&#039;_delete&#039;&quot;&gt;\n        &lt;input type=&quot;checkbox&quot; attr=&quot;name: &#039;product&#091;&#039;+code + &#039;_delete]&#039;, id: uid+&#039;_delete&#039;, form: formId&quot;&gt;\n        &lt;span data-bind=&quot;i18n:&#039;Delete&#039;&quot;&gt;&lt;\/span&gt;\n    &lt;\/label&gt;\n&lt;\/span&gt;\n&lt;!-- \/ko --&gt;<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1280\" height=\"498\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype.png\" alt=\"\" class=\"wp-image-145488\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype.png 1280w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype-250x97.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype-300x117.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype-768x299.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype-1200x467.png 1200w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>In this way we can create file type product attribute in magento 2. Thanks.. \ud83d\ude42<\/p>\n\n\n\n<p>For complete module please find at <a href=\"https:\/\/github.com\/rani-webkul\/product-file-attribute\">https:\/\/github.com\/rani-webkul\/product-file-attribute<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, we\u2019ll explain how to Create Product File Type Attribute in Magento 2, covering setup steps and practical use cases for file uploads. Follow the below steps in order to create file type attribute: Step 1: First of all we have to create a product attribute with input type &#8220;File&#8221;. Here I&#8217;m creating <a href=\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":143,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[302],"tags":[354,7578,7579,580,7580],"class_list":["post-145477","post","type-post","status-publish","format-standard","hentry","category-magento2","tag-attribute","tag-create-product-file-type-attribute-in-magento-2","tag-file-type-attribute","tag-product","tag-product-file-type-attribute"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Create Product File Type Attribute in Magento 2<\/title>\n<meta name=\"description\" content=\"we\u2019ll explain how to create product file type attribute in Magento 2, covering setup steps and practical use cases for file uploads.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create Product File Type Attribute in Magento 2\" \/>\n<meta property=\"og:description\" content=\"we\u2019ll explain how to create product file type attribute in Magento 2, covering setup steps and practical use cases for file uploads.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-09-28T12:12:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-15T13:19:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype.png\" \/>\n<meta name=\"author\" content=\"Rani Priya\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rani Priya\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/\"},\"author\":{\"name\":\"Rani Priya\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/41b545a754c2050d9bf1bdd689cc7433\"},\"headline\":\"Create Product File Type Attribute in Magento 2\",\"datePublished\":\"2018-09-28T12:12:27+00:00\",\"dateModified\":\"2026-01-15T13:19:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/\"},\"wordCount\":210,\"commentCount\":31,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype.png\",\"keywords\":[\"Attribute\",\"Create Product File Type Attribute in Magento 2\",\"file type attribute\",\"product\",\"product file type attribute\"],\"articleSection\":[\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/\",\"url\":\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/\",\"name\":\"Create Product File Type Attribute in Magento 2\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype.png\",\"datePublished\":\"2018-09-28T12:12:27+00:00\",\"dateModified\":\"2026-01-15T13:19:52+00:00\",\"description\":\"we\u2019ll explain how to create product file type attribute in Magento 2, covering setup steps and practical use cases for file uploads.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype.png\",\"width\":1280,\"height\":498},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create Product File Type Attribute in Magento 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/41b545a754c2050d9bf1bdd689cc7433\",\"name\":\"Rani Priya\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/14d4027e5c23be01f55f93fe41b566aeb282dd9382ff8f4ceb4741cd1d00d74e?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/14d4027e5c23be01f55f93fe41b566aeb282dd9382ff8f4ceb4741cd1d00d74e?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"caption\":\"Rani Priya\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/rani-priya439\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create Product File Type Attribute in Magento 2","description":"we\u2019ll explain how to create product file type attribute in Magento 2, covering setup steps and practical use cases for file uploads.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/","og_locale":"en_US","og_type":"article","og_title":"Create Product File Type Attribute in Magento 2","og_description":"we\u2019ll explain how to create product file type attribute in Magento 2, covering setup steps and practical use cases for file uploads.","og_url":"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2018-09-28T12:12:27+00:00","article_modified_time":"2026-01-15T13:19:52+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype.png","type":"","width":"","height":""}],"author":"Rani Priya","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Rani Priya","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/"},"author":{"name":"Rani Priya","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/41b545a754c2050d9bf1bdd689cc7433"},"headline":"Create Product File Type Attribute in Magento 2","datePublished":"2018-09-28T12:12:27+00:00","dateModified":"2026-01-15T13:19:52+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/"},"wordCount":210,"commentCount":31,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype.png","keywords":["Attribute","Create Product File Type Attribute in Magento 2","file type attribute","product","product file type attribute"],"articleSection":["Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/","url":"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/","name":"Create Product File Type Attribute in Magento 2","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype.png","datePublished":"2018-09-28T12:12:27+00:00","dateModified":"2026-01-15T13:19:52+00:00","description":"we\u2019ll explain how to create product file type attribute in Magento 2, covering setup steps and practical use cases for file uploads.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/09\/filetype.png","width":1280,"height":498},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/create-and-manage-product-file-type-attribute-in-magento-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Create Product File Type Attribute in Magento 2"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/41b545a754c2050d9bf1bdd689cc7433","name":"Rani Priya","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/14d4027e5c23be01f55f93fe41b566aeb282dd9382ff8f4ceb4741cd1d00d74e?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/14d4027e5c23be01f55f93fe41b566aeb282dd9382ff8f4ceb4741cd1d00d74e?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","caption":"Rani Priya"},"url":"https:\/\/webkul.com\/blog\/author\/rani-priya439\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/145477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/143"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=145477"}],"version-history":[{"count":9,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/145477\/revisions"}],"predecessor-version":[{"id":522022,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/145477\/revisions\/522022"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=145477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=145477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=145477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}