I have a problem. When trying to edit a docx document with PHP, instead of editing it, the entire document is deleted. I have tried a thousand different ways but I can’t.
At the moment I have this code:
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['enviar'])) {
$doc = $_POST['doc'];
$contenido_modificado = $_POST['contenido'];
file_put_contents($doc, $contenido_modificado);
echo "Cambios guardados en $doc";
}
I have tested that $doc is correct, and the $modified_content is correct, but when I hit submit to modify, everything is deleted or not saved.
Thank you
I tried to use the PHPWord library but it doesn’t work for me
ivan jimenez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3