Support for Direct File Upload via Presigned URLs/SAS Tokens #850
Replies: 4 comments 1 reply
-
hi @mandm-pt did you try the graph TD
A[Frontend] -->|send file to| B[Your backend]
B -->|upload file to| C[Azure Blob]
C -->|get Blob URL and SAS token from| D[Your backend]
D -->|send Blob URL and SAS token to| E[KM]
E -->|download file from| C
E -->|extract content from file| F[KM]
|
Beta Was this translation helpful? Give feedback.
-
Hi @dluc thank you for your quick reply. That reflects on the Basically this work around works from the point of view of getting the content of the file processed, but the file that was directly uploaded to the storage is kind of disconnected and is treated as any regular URL existing on the internet and not like an uploaded file. |
Beta Was this translation helpful? Give feedback.
-
Forgot to add the diagram with the steps that I am proposing. graph TD
A[Frontend] -->|1 - Get link to upload file| B[Your backend]
A -->|2 - upload file to| C[Azure Blob]
A -->|3 - Acknoledge file upload| B[Your backend]
B -->|4 - Tells KM to start processing file| D[KM]
C -->|5 - extract content from file that already exists in storage| D[KM]
Step 5 implies downloading the file, but assumes the upload was performed by KM and not a publicly accessible file |
Beta Was this translation helpful? Give feedback.
-
The important thing is that the upload works with the existing API. The problem seems to be only with Is that something you could handle in the backend replacing the SAS token with a new one? |
Beta Was this translation helpful? Give feedback.
-
Currently, when using the KM service, file uploads must be handled through a secure backend service or app. It is not feasible to upload files directly from a frontend or a publicly published app because API keys cannot be securely stored in public code.
To work around this, files must be uploaded to the backend, which then uploads them to the KM service. However, platforms like AWS and Azure Blob Storage offer Presigned URLs and SAS Tokens, allowing files to be securely uploaded directly to storage without routing through the backend.
Proposed Solution: Introduce a feature that enables direct file uploads to storage (e.g., AWS S3 or Azure Blobs) via presigned URLs or similar mechanisms. The workflow would be:
Retrieve a URL for direct upload.
Upload the file contents to the storage directly from the frontend.
Notify the KM service that the file is available for processing.
Checking the code I see 4 implementation of
IDocumentStorage
. Follows the way I see it working for 3 of them, for Mongo I am not sure how we could make it working.This feature would simplify the upload process, improve security, and reduce backend overhead by enabling direct uploads from the client-side while ensuring that KM is aware when a file is ready for processing.
Beta Was this translation helpful? Give feedback.
All reactions