Advertisement
chaminga

invoice_man_code_3

Oct 17th, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1.     function save(){
  2.         $file = JRequest::getVar('jform', null, 'files', 'array');
  3.         $path = JPATH_BASE;
  4.  
  5.         // Make the file name safe.
  6.         jimport('joomla.filesystem.file');
  7.         $file['name']['invoice'] = JFile::makeSafe($file['name']['invoice']);
  8.  
  9.         // Move the uploaded file into a permanent location.
  10.         if (isset($file['name']['invoice'])) {
  11.             // Make sure that the full file path is safe.
  12.             $filepath = JPath::clean($path. DS ."components". DS ."com_invoicemanager". DS ."files". DS .strtolower($file['name']['invoice']));
  13.             // Move the uploaded file.
  14.             if(JFile::upload( $file['tmp_name']['invoice'], $filepath ))
  15.             {
  16.             $db =& JFactory::getDBO();
  17.             $query = $db->getQuery(true);
  18.             $query->update($db->nameQuote('#__invoicemanager'));
  19.             $query->set($invoice.' = '.$db->quote($file['name']['invoice']));
  20.             $query->where($db->nameQuote('id').'='.$db->quote($id));
  21.             $db->setQuery($query);
  22.             $db->query();
  23.             }
  24.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement