Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- $this->db->trans_begin();
- if ( ! @copy('/source_dir/filename.jpg', '/destination_dir/filename.jpg'))
- {
- throw new Exception('failed copying file.');
- }
- if ( ! $this->db->insert('table1', $mydata))
- {
- throw new Exception('failed inserting data.');
- }
- $this->db->trans_commit();
- $this->session->set_flashdata('message', 'all process succeeded!');
- }
- catch (Exception $e)
- {
- $this->db->trans_rollback();
- @unlink('/destination_dir/filename.jpg');
- $this->session->set_flashdata('message', $e->getMessage());
- }
Add Comment
Please, Sign In to add comment