Discussions

Ask a Question
Back to All

Attaching the file to job diary - Filename changed

https://developer.servicem8.com/docs/attaching-files-to-a-job-diary

The pdf file I uploaded suddenly changed its filename after following the documentation. If I manually updated the filename it shows properly? Is there any issue on the filename on api?

const blob = new Blob([file.data], { type: "application/octet-stream" });
  formData.append("file", blob, decodedFilename);

  const uploadResponse = await fetch(
    `https://api.servicem8.com/api_1.0/Attachment/${attachmentUuid}.file`,
    {
      method: "POST",
      headers: {
        authorization: `Bearer ${token}`,
        Accept: "application/json",
      },
      body: formData,
    }
  );