Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

image uploading using formdata

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;
Source by maximorlov.com #
 
PREVIOUS NEXT
Tagged: #image #uploading #formdata
ADD COMMENT
Topic
Name
1+8 =