Changes api call to import file
parent
54d741eb5a
commit
d813749032
|
@ -334,7 +334,22 @@
|
|||
// Aquí puedes realizar la llamada al API para subir el archivo utilizando fetch o la biblioteca que prefieras.
|
||||
const archivo = fileInput.files[0];
|
||||
const formData = new FormData();
|
||||
formData.append('archivo', archivo);
|
||||
formData.append('file_input_name', archivo);
|
||||
fetch('https://localhost/opengnsys/rest/dhcp/upload', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
console.log('Archivo subido con éxito');
|
||||
location.reload();
|
||||
} else {
|
||||
console.error('Error al subir el registro');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error al realizar la solicitud:', error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue