'Forbidden Error 403: When Uploading file in WebApp | Community
Skip to main content
Level 5
May 27, 2024
Question

'Forbidden Error 403: When Uploading file in WebApp

  • May 27, 2024
  • 1 reply
  • 1847 views

Hi team,

 

I am using v8, and trying to upload a file to ACC using  /nl/jsp/uploadFile.jsp.

When we use the v5 compatibility fileInput file gets uploaded to the server, while if I use the normal HTML and AJAX to upload the file, it gives an error. ( 403 - Forbidden )

 

If I use postman / nodejs script to read the file and upload to /nl/jsp/uploadFile.jsp, file gets uploaded properly. 

 

What could be the reason 403 error, I tried with __sessiontoken cookie, __securitytoken, and also with Bearer Token, which works in postman, but not within the WebApp

 

Please help 

 

Regards,

DG

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Manoj_Kumar
Community Advisor
Community Advisor
May 28, 2024

Hello @dipendu_g Are you using correct form encoding to upload file via Ajax?

 

Here is what is used in form to upload images.

enctype="multipart/form-data"

 

Manoj     Find me on LinkedIn
dipendu_gAuthor
Level 5
May 28, 2024

Hi @_manoj_kumar_ , 

 

I am using FormData to store the uploaded file and then using fetch to upload. 

 

await fetch('/nl/jsp/uploadFile.jsp', { method: "POST", body: formData, headers:myHeaders });
dipendu_gAuthor
Level 5
May 28, 2024

Hello @dipendu_g what is the value of formDate here?


Hi @_manoj_kumar_ 

 

let formData = new FormData(); formData.append("file",files[0])

 

Regards