Reputation: 9986
I am new to Joomla, but i cannot seem to find a way to manually change the name of an uploaded file... please tell me how, if it is possible... i am a WordPress guy !
Do I have to install something more, because now, the only option I have is DELETE !
Upvotes: 0
Views: 3225
Reputation: 8282
I know its an old post but it may help someone in future,
using joomla uploader just need to change like below.
$file = JRequest::getVar('attachment', null, 'files', 'array');//attachment is the file type name in your html
jimport('joomla.filesystem.file');
$filename = JFile::makeSafe($file['name']);
$src = $file['tmp_name'];
$dst = JPATH_SITE . DS . "images" . DS . 'archive'. DS. 'your_new_file_name'.JFile::getExt($filename);
if ( JFile::upload($src, $dest) ){
echo 'Uploaded';
}
else{
echo 'Failed';
}
Hope it helps someone..
Upvotes: 0