Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • Hello, If i have module xml file then what should i pass into getDirectoryWrite function? Commented Sep 14, 2018 at 12:13
  • you should pass same directory of magento. if your custom module then you have to create folder in media folder. you have to change name "module1" by your module name Commented Sep 22, 2018 at 23:34
  • 1
    Good solution, but you should inject the dependency (only \Magento\Framework\Filesystem needed) into the constructor instead of using the object manager. Instead of $directoryList::MEDIA you can use \Magento\Framework\App\Filesystem\DirectoryList::MEDIA. Commented Apr 27, 2021 at 10:53
  • @Dhrumin can u post the answer or post the link to the answer here? Commented Sep 22, 2021 at 6:50
  • this solution can work with xml file, tried and working good. Commented Sep 22, 2021 at 7:17