Files
niknah-presentation-ComfyUI/presentation-site/utils/uploadFile.js
T
2025-10-12 17:21:15 +11:00

18 lines
361 B
JavaScript

export default function (file, path) {
const body = new FormData();
body.append('image', file);
body.append('subfolder', path);
return fetch('/api/upload', {
method: 'POST',
body
}).then((resp) => {
if (resp.status !== 200) {
// Alert
}
console.log(resp);
return resp.json();
}).then((obj) => {
return obj;
});
}