Magento 2: Upload File & Image
This article shows how you can upload files and images in Magento 2. You can use this code in any custom module you build. Here’s the input file field HTML code: <input type="file" name="my_custom_file" id="my_custom_file" title="Custom File" class="input-text" data-validate="{required:true}"> Here’s the controller class file code: <?php namespace YourNamespace\YourModule\Controller; use Magento\Framework\App\Action\Context; use Magento\Framework\Message\ManagerInterface; use Magento\Framework\Filesystem; use … Read more