vhs9210 Posted July 31, 2014 Share Posted July 31, 2014 hi! to everyone!!. I am new in prestashop 1.6, actually I am starting developing simple applications, adding some menus like "teacher" in the backoffice, It has just the basic information, (name, address and telephone) but also has an photo_path field, which allows me to upload an image, I've created a (type ='file') and it allows to upload it, ok but the problem is when I want to store the image_path to my database in the field photo_path, I used this code in my teachersController.phpif (Tools::isSubmit('submitAddteacher')) { if ($_FILES["photo_path"]["name"]) { $imgName = $this->getImageName( Tools::getValue('id_teacher') ); $temp = explode(".", $_FILES["photo_path"]["name"]); $extension = end($temp); $imgName.= ".".$extension; $this->insertTeacherImage( Tools::getValue('id_teacher'), $imgName ); ImageManager::resize($_FILES["teacher"]["tmp_name"], _PS_IMG_DIR_."Teacher/".$imgName , 219 , 219); chmod(_PS_IMG_DIR_."Teacher/".$imgName, 0777); } } and in the header: $this->fieldImageSettings = array( 'name' => 'photo_path', 'dir' => "Teacher" );and it save the image into the directory Teacher in /img/Teacher and also rename the image with a simple number like "15.jpg", but it is not saving the image_path into my database, in my class Teacher.php I defined : public $photo_path;public static $definition = array( 'table' => 'teacher', 'primary' => 'id_teacher', 'fields' => array( 'photo_path' => array('type' => self::TYPE_STRING, 'required' => true, 'size' => 32),but when I do this, when i fill the form and upload the image shows me an error "photo_path is empty". please help me. Link to comment Share on other sites More sharing options...
vhs9210 Posted August 1, 2014 Author Share Posted August 1, 2014 (edited) :S Edited August 1, 2014 by vhs9210 (see edit history) Link to comment Share on other sites More sharing options...
vhs9210 Posted August 5, 2014 Author Share Posted August 5, 2014 ??? Link to comment Share on other sites More sharing options...
Recommended Posts