Hi.
I have this code:
const fileBody = `------${uuid}
Content-Disposition: form-data; name="file"; filename=${file.name}
Content-Type: application/pdf
${newFile}
------${uuid}--`;
const fileUploadResponse = await fetch(formUrl, {
method: "POST",
headers: {
Authorization: bearerToken ?? "",
Cookie: xsrfCookie,
"Content-Type": `multipart/form-data; boundary=------${uuid}`,
"X-XSRF-TOKEN": csrfToken ?? "",
},
body: fileBody,
});
I'm trying to upload the file to my submission. I have successfully added the traditionalpageone and the license items, but I can't upload the file.
I get this missage: Response { status: 400,
statusText: '',
headers:
Headers { date: 'Mon, 14 Apr 2025 09:23:04 GMT',
server: 'Apache',
vary: 'Origin,Access-Control-Request-Method,Access-Control-Request-Headers',
'content-language': 'ca,es,en',
'x-content-type-options': 'nosniff',
'x-xss-protection': '0',
'cache-control': 'no-cache, no-store, max-age=0, must-revalidate',
pragma: 'no-cache',
expires: '0',
'strict-transport-security': 'max-age=31536000 ; includeSubDomains',
'x-frame-options': 'DENY',
'content-type': 'application/problem+json;charset=UTF-8',
'content-security-policy': "frame-ancestors 'self';",
'access-control-expose-headers':
'Authorization, expires, Location, Content-Disposition, WWW-Authenticate, Set-Cookie, X-Requested-With, DSPACE-XSRF-TOKEN',
'access-control-allow-origin': '
https://new-bcnroc.metricsalad.com',
'access-control-allow-credentials': 'true',
'access-control-allow-methods': 'PUT, GET, POST, DELETE, OPTIONS, PATCH',
connection: 'close',
'transfer-encoding': 'chunked' },
body: ReadableStream { locked: false, state: 'readable', supportsBYOB: true },
bodyUsed: false,
ok: false,
redirected: false,
type: 'basic',
url: '
https://api-new-bcnroc.metricsalad.com/api/submission/workspaceitems/143964' }