E ai pessoal,
Estou fazendo um compontente de download personalizado para uma prefeitura colocar as leis no site.
Estou tendo dificuldade com o envio dos arquivos...
A inserção mostra como inserido com sucesso, mas o arquivo nao esta dentro da pasta que deveria estar...
function salvar (){
$row = & $this -> getTable();
$dados = JRequest :: get ('post');
//Retrieve file details from uploaded file, sent from upload form
$file = JRequest::getVar('file_upload', null, 'files', 'array');
//Import filesystem libraries. Perhaps not necessary, but does not hurt
jimport('joomla.filesystem.file');
//Clean up filename to get rid of strange characters like spaces etc
$filename = JFile::makeSafe($file['name']);
//Set up the source and destination of the file
$src = $file['tmp_name'];
$dest = JPATH_COMPONENT_SITE . DS . "uploads" . DS . "leis" .ds. $filename;
//First check if the file has the right extension, we need jpg only
if ( strtolower(JFile::getExt($filename) ) == 'pdf') {
if ( JFile::upload($src, $dest) ) {
if (!$row->bind($dados)) {
$this -> SetError ($this -> _db -> getErrosMsg());
return false;
}
if (!$row->check()) {
$this -> SetError ($this -> _db -> getErrosMsg());
return false;
}
if (!$row->store()) {
$this -> SetError ($this -> _db -> getErrosMsg());
return false;
}
} else {
$this -> SetError ($this -> _db -> getErrosMsg());
return false;
}
} else {
//Redirect and notify user file is not right extension
}
Outra coisa....como faço para pegar o nome do arquivo e salvar no BD?
Aguardo ajuda