0

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::getVar( 'img2', null, 'files', 'array' );
jimport('joomla.filesystem.file');
$filename = JFile::makeSafe($file);
$src = $file;
$image = mysql_escape_string(file_get_contents($file));
$type_img=strtolower(JFile::getExt($file));

$db =& JFactory::getDBO();
$query = "UPDATE #__prifoot SET extension2='".$type_img."' WHERE id = '89' ";
$db->setQuery($query);
$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(JFile::getExt($file)) returns a null value. and i dont know why!! is the mistakes in the method JRequest::getVar( 'img2', null, 'files', 'array' ) which i'm using to get file?

Thank you.
hassal

Edited by hassal: n/a

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by hassal
0

Just do a dump of the variable to see if you got it correctly.

$file = JRequest::getVar( 'img2', null, 'files', 'array' );
var_dump($file);
die;
0

thank your for your quick reply.
i have done this and it gives me the following message :
Warning: strrpos() expects parameter 1 to be string, array given in E:\wamp\www\Joomla\libraries\joomla\filesystem\file.php on line 38
array(1) { [0]=> string(0) "" }

0

also when i use this :
var_dump( $file);
die;
it gives me the value : NULL
it means that i cant get it correctly.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.