Overview
Uploads a file to Replyke storage without any server-side processing. The raw file is stored and a proxy URL is returned. Use this for PDFs, videos, Office documents, or any file type where you don’t need variant generation. For images that need resizing or format conversion, useuseUploadImage instead.
Requires an authenticated user. The hook uses the private axios instance and will throw if no session is active.
Usage Example
Parameters
uploadFile(file, pathParts, options?) accepts three arguments:
The file to upload. In the browser, pass a standard
File object. In React Native, pass { uri, name, type? }.Storage path segments. The file is stored under the joined path, with a UUID sub-folder appended automatically for uniqueness. For example,
["documents", "user-123"] stores the file at documents/user-123/<uuid>/<filename>.Optional associations and metadata.
Options
Associates the file with an entity. The file is deleted when the entity is deleted.
Associates the file with a comment. The file is deleted when the comment is deleted.
Associates the file with a space.
Display order when a record has multiple attachments. Defaults to
0.Custom key-value data stored alongside the file record.
Returns
The hook returns theuploadFile function directly (no state wrappers). The function returns a Promise<UploadResponse>:
The
type field is inferred automatically from the file’s MIME type. PDFs and Office documents become "document", video files become "video", images become "image", and everything else becomes "other".
