2D-3D / static /js /human.js
Timilehin's picture
Upload 20 files
b1f991e verified
Raw History Blame Contribute Delete
1.16 kB
document.getElementById('upload-form').addEventListener('submit', function(event) {
event.preventDefault();
var loadingIndicator = document.getElementById('loading-indicator');
loadingIndicator.style.display = 'inline-block';
var downloadLink = document.getElementById('download-link');
downloadLink.style.display = 'none';
var formData = new FormData();
var fileInput = document.getElementById('file-input');
formData.append('file', fileInput.files[0]);
fetch('/generate-mesh', {
method: 'POST',
body: formData
})
.then(response => response.blob())
.then(blob => {
var url = window.URL.createObjectURL(blob);
downloadLink.href = url;
downloadLink.download = 'output.obj';
downloadLink.style.display = 'block';
downloadLink.textContent = 'Download Generated OBJ File';
loadingIndicator.style.display = 'none';
document.getElementById('next-btn').style.display = 'block';
})
.catch(error => {
console.error('There was a problem with the fetch operation:', error);
loadingIndicator.style.display = 'none';
});
});