Forums

file upload: add user_id

navajofra 21 Mar, 2010
How can I add the user_id of the user table to the file upload name?

I have tried:

$filename = 'id_'.<?php $user = JFactory::getUser(); echo $user->id; ?>.'_'.date('YmdHis').'_'.$chronofile['name'];

but it doesn´t work.
GreyHead 21 Mar, 2010
Hi navajofra,

The PHp tags are effectively already open so adding more doesn't help. Please try this:
$user =& JFactory::getUser();$filename = 'id_'.$user->id.'_'.date('YmdHis').'_'.$chronofile['name'];

Bob
navajofra 04 Apr, 2010
Yes thanks
it works now pretty well.
This topic is locked and no more replies can be posted.