Editar Oficio

prepare($sql); $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc(); } if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['id'])) { $id = $_POST['id']; $titulo = $_POST['titulo']; $archivo = $_FILES['archivo']['name']; $archivo_path = ''; if ($archivo) { $target_dir = "sistema de noticias/oficios/"; $archivo_path = $target_dir . basename($archivo); move_uploaded_file($_FILES['archivo']['tmp_name'], $archivo_path); } else { $archivo_path = $_POST['archivo_actual']; } $sql = "UPDATE oficios SET titulo = ?, archivo = ? WHERE id = ?"; $stmt = $conn->prepare($sql); $stmt->bind_param("ssi", $titulo, $archivo_path, $id); if ($stmt->execute()) { echo "El oficio se ha actualizado exitosamente."; } else { echo "Error al actualizar el oficio: " . $stmt->error; } } ?>
Archivo actual: Ver archivo