Hello,
I'm developping a new joomla component, so i want to store pictures in database table in field type : blob. i'm wondery how to proceed to do this.
I'm using this to get file from the form :
$file = JRequest::getVa r( 'img2', null, 'files', 'array' );
jimport('joomla .filesystem.fil e');
$filename = JFile::makeSafe ($file['img2']);
$src = $file['tmp_name'];
$image = mysql_escape_st ring(file_get_c ontents($file['img2']['tmp_name']));
$type_img=strto lower(JFile::ge tExt($file));
$db =& JFactory::getDB O();
$query = "UPDATE #__prifoot SET extension2='".$ type_img."' WHERE id = '89' ";
$db->setQuery($quer y);
$db->query();
as you see in this step i want just to get extension of the file and store it in database for just for test, and when i check my database table jos_prifoot i have in the field extension2 null value!
it means that the method strtolower(JFil e::getExt($file )) returns a null value. and i dont know why!! is the mistakes in the method JRequest::getVa r( 'img2', null, 'files', 'array' ) which i'm using to get file?
Thank you.
hassal
I'm developping a new joomla component, so i want to store pictures in database table in field type : blob. i'm wondery how to proceed to do this.
I'm using this to get file from the form :
$file = JRequest::getVa r( 'img2', null, 'files', 'array' );
jimport('joomla .filesystem.fil e');
$filename = JFile::makeSafe ($file['img2']);
$src = $file['tmp_name'];
$image = mysql_escape_st ring(file_get_c ontents($file['img2']['tmp_name']));
$type_img=strto lower(JFile::ge tExt($file));
$db =& JFactory::getDB O();
$query = "UPDATE #__prifoot SET extension2='".$ type_img."' WHERE id = '89' ";
$db->setQuery($quer y);
$db->query();
as you see in this step i want just to get extension of the file and store it in database for just for test, and when i check my database table jos_prifoot i have in the field extension2 null value!
it means that the method strtolower(JFil e::getExt($file )) returns a null value. and i dont know why!! is the mistakes in the method JRequest::getVa r( 'img2', null, 'files', 'array' ) which i'm using to get file?
Thank you.
hassal
Comment