in magento 2.3.1 below code is work
<field id="file_upload" translate="label" type="Magento\Config\Block\System\Config\Form\Field\File" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Upload File</label>
<backend_model>Magento\Config\Model\Config\Backend\File</backend_model>
<upload_dir config="system" scope_info="1">customUpload</upload_dir>
</field>
but in Magento 2.3.3 this not working it give error
Invalid parameter given. A valid $fileId[tmp_name] is expected.
-
If is not Magento 2.3.3 issue. Because I've used same code in my M2.3.3 and it is working fine. Can you please use this configuration anywhere else and check ?Kishan Savaliya– Kishan Savaliya2019年10月16日 18:00:04 +00:00Commented Oct 16, 2019 at 18:00
-
Hi @KishanSavaliya i used this configuration in my custom module where i getting this error also i test this code in localChandresh Chauhan– Chandresh Chauhan2019年10月17日 04:03:37 +00:00Commented Oct 17, 2019 at 4:03
-
can you please check you exception.log or system.log in var/log directory ? From where you're getting this issue ? Is that your any custom module or default magento file ?Kishan Savaliya– Kishan Savaliya2019年10月17日 04:08:35 +00:00Commented Oct 17, 2019 at 4:08
-
no i have install new magento 2.3.3 and also magento core functionality in configuration -> Sales -> Invoice and Packing Slip Design -> Logo for PDF Print-outs (200x50) not working , in live server it's work but not in localChandresh Chauhan– Chandresh Chauhan2019年10月17日 05:19:03 +00:00Commented Oct 17, 2019 at 5:19
-
You can check this image <drive.google.com/file/d/1WL17yXTjJDHOZk8IVaEhwCelyIpSonUu/…> I just updated that image here which you've mentioned here. And that is working with default Magento 2.3.3 version.Kishan Savaliya– Kishan Savaliya2019年10月17日 07:45:50 +00:00Commented Oct 17, 2019 at 7:45
2 Answers 2
i got the issue in file Magento\Framework\File\Uploader.php in which new method was added so i just comment that method, in function _setUploadFileId($fileId) found the
$this->validateFileId($fileId);
change to
//$this->validateFileId($fileId);
it's work in my case in local server
-
by simply removing the validation, you don't solve the problem. You just ignore it. And: It's never a good idea to change a file in vendor/* as it will be rewritten on every deployment (composer install/update).Ali Raza– Ali Raza2020年09月14日 11:41:53 +00:00Commented Sep 14, 2020 at 11:41
-
1yes @AliRaza i know that change in vendor/* is never recommended but it's only for in local (xampp) server. in liver server works fine without any changes.Chandresh Chauhan– Chandresh Chauhan2020年09月14日 12:27:56 +00:00Commented Sep 14, 2020 at 12:27
-
In my enviroment i found this issue in shared hosting. the validate function check the file uploaded by php in an array of dirs including the sys_get_temp_dir(), but that dir is different from $_FILES['input']['tmp_name'] base dir. exampls: sys_get_temp_dir() = /tmp dir where php put temp file in my vhost: /home/mydomain/tmp and so it fails during validation. you should extend the Uploader.php with aplugin to add your local tmp pathnino.aratari– nino.aratari2021年03月23日 13:05:22 +00:00Commented Mar 23, 2021 at 13:05
In my enviroment i found this issue in shared hosting. the validate function check the file uploaded by php in an array of dirs including the sys_get_temp_dir(), but that dir is different from $_FILES['input']['tmp_name'] base dir.
exampls:
sys_get_temp_dir() = /tmp
dir where php put temp file in my vhost: /home/mydomain/tmp
and so it fails during validation.
you should extend the Uploader.php with aplugin to add your local tmp path