Get an error message when trying to add product image
-
1Check file permissions on media folder (775 for directory and 664 for files)– Anna VölklMar 9, 2016 at 11:50
-
set permissions on media folder.. but still getting the same error :(– SruthiMar 10, 2016 at 6:11
-
1.) Did it work before? 2.) What did you change before it stopped working? Please update your question with some more information.– Anna VölklMar 10, 2016 at 7:21
-
i have changed permission on media folder.. then upload image to a product.. but its getting the same error[see screenshot]– SruthiMar 10, 2016 at 9:00
-
plz help me to solve this issue.. :(– SruthiMar 16, 2016 at 11:28
2 Answers
I also encountered in the same issue when I installed magento with php 7 during the analysis I came to know the issue was coming through below file ;
E:\Xampp7\htdocs\magento19\lib\Varien\File\Uploader.php:274 Uncaught Error: Function name must be a string in
To resolve this issue just replace below code:
At Line 274: $params['object']->$params['method']($this->_file['tmp_name']);
to
$params['object']->{$params['method']}($this->_file['tmp_name']);
Open file : /public_html/lib/Varien/File/Uploader.php
Find: (line: 272)
//run validate callbacks
foreach ($this->_validateCallbacks as $params) {
if (is_object($params['object']) && method_exists($params['object'], $params['method'])) {
$params['object']->$params['method']($this->_file['tmp_name']);
}
}
And Replace:
//run validate callbacks
foreach ($this->_validateCallbacks as $params) {
if (is_object($params['object']) && method_exists($params['object'], $params['method'])) {
$params['object']->{$params['method']}($this->_file['tmp_name']);
}
}