Hi, I'd recommend checking the DSpace backend logs to see if it has more information about the cause of the 400 error. A 400 error is a "Bad Request", but sometimes the easiest way to debug it is to get the detailed error message from the backend.
If nothing appears in the backend logs, then you could also temporarily turn on debug mode for the REST API, so that a more detailed error is sent back in the 400 response. See the troubleshooting guide for details on how to enable debug mode: https://wiki.lyrasis.org/display/DSPACE/Troubleshoot+an+error#Troubleshootanerror-3.DebugmodefortheRESTAPI(ifnecessary) Tim On Monday, April 14, 2025 at 4:31:04 AM UTC-5 Alfredo Alexander wrote: > 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' > } > > Can you help me to solve it? > -- All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx --- You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/dspace-tech/ae8996c0-fc1a-4377-8cee-ec9dbcda63acn%40googlegroups.com.
