This is what I did, I added variables in \libraries\joomla\database\table\user.php:
var $img_content= null; //contains the blob type data var $img_name = null; var $img_type = null;
then I added this code in \components\com_user\controller.php:
$file = JRequest::getVar( 'pic', '', 'files', 'array' );
if(isset($file['name']))
{
jimport('joomla.filesystem.file');
$fileName = $file['name'];
$tmpName = $file['tmp_name'];
$fileSize = $file['size'];
$fileType = $file['type'];
$fp = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
//$content = addslashes($content);
fclose($fp);
$user->set('img_name', $fileName);
$user->set('img_type', $fileType);
$user->set('img_content', $content);
}
that works fine, but I found this problem in logging in with the new user with an uploaded photo, other user with an empty img_content field could login properly. What happens is when I log-in using the user with uploaded photo, it's not redirecting properly it just return to log-in, but when i log-in through backend using other user which is super admin, i could see that user which appears as logged in.
I started saving the images in the database because I am having problem with the directory when I have uploaded the site.
I think the log-in was affected by the blob type data in the database. Could that be the problem? What could be the solution?
-saeha