ramzirahmouni Posted December 11, 2015 Share Posted December 11, 2015 Hello,I want to have the function or class responsible for the action of deleting a file or image ...If there is a delete then the total file size should be decreased for each customer.I'm succeeding to add (upload) with the addition of the current size test. But I still have for deletion. I added my code to the DeleteFile function in the Tools class as follows: /** * Delete file * * @param string $file File path * @param array $exclude_files Excluded files */ public static function deleteFile($file, $exclude_files = array()) { if (isset($exclude_files) && !is_array($exclude_files)) { $exclude_files = array($exclude_files); } if (file_exists($file) && is_file($file) && array_search(basename($file), $exclude_files) === false) { @chmod($file, 0777); // NT ? unlink($file); } /************************************Modification**************************/ $size = ''; $size_max = ''; $size1 = ''; $cookie = new Cookie('psAdmin'); $id_employee = $cookie->id_employee; $id_shop = ''; $sql = 'SELECT * FROM '._DB_PREFIX_.'employee_shop WHERE id_employee = '.(int)$id_employee.' '; if ($row = Db::getInstance()->getRow($sql)) $id_shop = $row['id_shop']; $sql1 = 'SELECT * FROM recap WHERE id_store = '.(int)$id_shop.' '; if ($row1 = Db::getInstance()->getRow($sql1)) { $size = $row1['size']; $size_max = $row1['size_max']; } if ($id_shop != 1) { $size1 = $size - $file['size']; Db::getInstance()->update('recap', array('size' => (int)$size1), $where = 'id_store = '.(int)$id_shop.'', $limit = 0, $null_values = false, $use_cache = true, $add_prefix = false); } /*************************Modification********************************/ } But no changes. Do you have a solution or instructions to do? Best regards. 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