Hello, i am trying to do a mass attachment upload. looking AdminAttachemnts.php i don't see any database writes? but there is a table with attachement information. so my question is how does the meta data show up in the database? once i got this figured out i can ftp upload a bunch of attachments and then write a script to add the meta data to the database...
public function postProcess()
{
if (Tools::isSubmit('submitAdd'.$this->table))
{
if ($id = intval(Tools::getValue('id_attachment')) AND $a = new Attachment($id))
{
$_POST['file'] = $a->file;
$_POST['mime'] = $a->mime;
}
if (!sizeof($this->_errors))
if (isset($_FILES['file']) AND is_uploaded_file($_FILES['file']['tmp_name']))
{
if ($_FILES['file']['size'] > $this->maxFileSize)
$this->_errors[] = $this->l('File too large, maximum size allowed:').' '.($this->maxFileSize/1000).' '.$this->l('kb');
else
{
$uploadDir = dirname(__FILE__).'/../../download/';
do $uniqid = sha1(microtime()); while (file_exists($uploadDir.$uniqid));
if (!copy($_FILES['file']['tmp_name'], $uploadDir.$uniqid))
$this->_errors[] = $this->l('File copy failed');
@unlink($_FILES['file']['tmp_name']);
$_POST['name_2'] .= '.'.pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
$_POST['file'] = $uniqid;
$_POST['mime'] = $_FILES['file']['type'];
}
}
$this->validateRules();
}
return parent::postProcess();
}