0

After upgrading from Magento 2.3.7-p2 to Magento 2.4.3-P1 I can't upload images, in Magento admin, I get this error message: The file was not uploaded

In var/log/exception.log file, i see this error:

main.CRITICAL: The file was not uploaded. {"exception":"[object] (DomainException(code: 666): The file was not uploaded. at ../../../vendor/magento/framework/File/Uploader.php:228)"} []

I am using an Apache 2.4 server, with Linux CentOS 7.9 and PHP 7.4.28

I already checked folder permissions and in theory, they are well configured.

If someone knows how to solve it, I appreciate it.

Thank you

4
  • Did you try sudo rm -rf /var/www/html/project/generated/code sudo rm -rf /var/www/html/project/pub/static/* sudo rm -rf /var/www/html/project/var/*
    – Paul Fan
    Commented Mar 24, 2022 at 21:49
  • Are images are uploading to vanilla Magento?Did you checked image's property?
    – Ankit
    Commented Mar 25, 2022 at 3:34
  • @Paul Fan, yes, i cleared that directories. Commented Mar 25, 2022 at 14:27
  • @Ankit, yes, i tested with a clean magento 3.4.3-p1 installation, same problem. Commented Mar 25, 2022 at 14:28

1 Answer 1

1

After trying it in several ways without success, I found a possible solution, although I don't know if it is a definitive solution.

I had to modify the php.ini file for the version of php I'm using. This worked for me with the global server file, not at the user/account level.

In the php.ini file i have this lines:

; Temporary directory for HTTP uploaded files (will use system default if not specified).

; http://php.net/upload-tmp-dir

;upload_tmp_dir =

Uncomment the last line and add the /tmp directory, in my case:

upload_tmp_dir = "/tmp"

then restart the PHP-FPM service

Uncommenting the rule fixes the problem. , but i have the doubt, if this may imply a security problem in the server and why this problem was not generated with magento 2.4.2 or 2.4.3, If anyone has more information on these details, I appreciate the help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.