public function write(midcom_db_attachment $target) { $src = fopen($this->_filename, 'r'); if (!$src) { debug_add("Could not open file '{$this->_filename}' for reading", MIDCOM_LOG_ERROR); return false; } if (!$target->copy_from_handle($src)) { debug_add("copy_from_handle() failed", MIDCOM_LOG_ERROR); fclose($src); return false; } fclose($src); return true; }