export async function newDocUpload(
access_token: string,
question_id: any,
upload_type:any,
file:any,
type:any,
id:any,
) {
const url = `${server_url}/rm/upload/doc/`;
const formdata = new FormData()
formdata.append('question_id',question_id);
formdata.append('upload_type',upload_type);
formdata.append('new_document_file',file);
formdata.append('type',type);
formdata.append('id',id);
try {
const response = await axios({
method: "post",
url: url,
data:formdata,
headers: {
Authorization: `Bearer ${access_token}`,
},
});
return response.data;
const form = document.getElementById('form');
const formData = new FormData(form);
const output = document.getElementById('output');
for (const [key, value] of formData) {
output.textContent += `${key}: ${value}
`;
}