Пример #1
0
 public function action_delete_file()
 {
     //delete product file
     $file_name = $_POST['file_name'];
     $obj_product = new Model_Product();
     $p_path = $obj_product->get_file($file_name);
     if (!is_file($p_path)) {
         echo $p_path;
         // echo $p_path;
         exit;
     } else {
         chmod($p_path, 0775);
         //delete product
         unlink($p_path);
     }
     // $product_delete = core::post('product_delete');
     // if($product_delete)
     // {
     //     $p_path = $obj_product->get_file($obj_product->file_name);
     //     if (!is_file($p_path))
     //     {
     //         return FALSE;
     //     }
     //     else
     //     {
     //         chmod($p_path, 0775);
     //         //delete product
     //         unlink($p_path);
     //         $obj_product->file_name = '';
     //         $obj_product->save();
     //         $this->redirect(Route::url('oc-panel', array('controller'  =>'product',
     //                                                               'action'      =>'update',
     //                                                               'id'          =>$obj_product->id_product)));
     //     }
     // }
 }