eliminar archivo
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
const connection = require('../conf/connection.js');
|
||||
const express = require('express');
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
var app = express()
|
||||
|
||||
@@ -35,6 +35,19 @@ app.get('/eliminar_persona', async(req, res) => {
|
||||
cad = `delete from persona where id_persona=${id};`;
|
||||
ans = await query(cad);
|
||||
|
||||
|
||||
if (fs.existsSync(`./files/carta_aceptacion-${id}.docx`)) {
|
||||
fs.unlinkSync(`./files/carta_aceptacion-${id}.docx`);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (fs.existsSync(`./files/comprobante_pago-${id}.docx`)) {
|
||||
fs.unlinkSync(`./files/comprobante_pago-${id}.docx`);
|
||||
}
|
||||
|
||||
|
||||
|
||||
res.status(200).json({ error: false, msj: "exito" });
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user