Removed sending file to the backend

Direct-to-storage upload instead of sending to the backend since sending files to the backend from the frontend is forbidden for some reason.
This commit is contained in:
shb 2025-06-18 12:13:06 +08:00
parent 0ba58a1efb
commit cb7f104b1d
2 changed files with 3 additions and 4 deletions

View File

@ -334,13 +334,12 @@ const performUpload = async () => {
const formData = new FormData();
formData.append('fileName', metadata.name);
formData.append('file', file);
// formData.append('file', file);
console.log(formData);
const response = await fetch('/api/dms/upload-file', {
method: "POST",
// Let browser automatically set headers for multipart/form-data
body: formData,
});
console.log(response);

View File

@ -42,7 +42,7 @@ export default defineEventHandler(async (event) => {
}
// Create S3 client with config
const client = new S3Client(S3_Config);
const s3Client = new S3Client(S3_Config);
// const { fileName, file } = await readMultipartFormData(event);
@ -69,7 +69,7 @@ export default defineEventHandler(async (event) => {
const command = new PutObjectCommand(input);
try {
const response = await client.send(command);
const response = await s3Client.send(command);
console.log(response);
return response;
} catch (error) {