How to save uploaded file to specific folder location using Magento 2?

You can save any file type to custom folder location using Magento 2.

If you are working with image, pdf or CSV file and you want to save the file to a specific location using Magento standard way, You have to add a dependency to your __construct function.

TheĀ move_uploaded_file() function moves an uploaded file to a new location using core PHP but you can do it Using Magento standard way.

Magento\Framework\Filesystem
Magento\MediaStorage\Model\File\UploaderFactory

Both the class used to save the file to a specific location.

Your phtml file contains input type file,
<input id=”filename” name=”filename” class=”input-file required” type=”file” aria-required=”true”> Continue reading “How to save uploaded file to specific folder location using Magento 2?”

How to import image using CSV in Magento 2?

Magento 2 Image import functionality is supported by Out of Box Magento. Its default Feature of Magento, you can import a list of product images via CSV from admin panel.

If you want to only import images for a product, You need to create a CSV file and add columns for different images.

Continue reading “How to import image using CSV in Magento 2?”