ctech Posted December 7, 2010 Share Posted December 7, 2010 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(); } Link to comment Share on other sites More sharing options...
tomerg3 Posted December 8, 2010 Share Posted December 8, 2010 All the database code is handled by objects (in /classes), and in this case /classes/Product.phpThis module may save you a lot of time http://www.prestashop.com/forums/viewthread/53511/ Link to comment Share on other sites More sharing options...
ctech Posted December 8, 2010 Author Share Posted December 8, 2010 Thats pretty cool module. but i can't start spending money on this project until i spend more time with it and see that it can do everything we want. Link to comment Share on other sites More sharing options...
Webtexsoftware Posted April 26, 2011 Share Posted April 26, 2011 Hello,There is another solution to achieve these goals: http://addons.prestashop.com/en/administration-tools/2474-product-attachments-pro.html Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now