How to delete file in magento 2 programmatically

delete file in magento 2 programatically - Jigar Karangiya

Hello Magento Devs,

In today’s tutorial, i’m going to show you how you can delete file in magento 2 programatically.

Method 1 : Using injecting class in constructor

We can delete file in magento standard way by injecting below class in constructor.

Let’s understand it by a simple example.

Method 2 : Directly using object manager (Not Recommended)

That’s it, now you know how to delete any file in magento standard way.

Thanks for reading !!

Leave a Reply

Your email address will not be published. Required fields are marked *