File Uploads with UploadThing
Secure, scalable file uploads without the complexity
UploadThing simplifies file uploads (e.g., product images, user avatars) with a developer-friendly API, integrating well with React Native and Next.js. It supports secure, scalable file storage without managing complex AWS S3 configurations directly.
Chosen for its ease of use and compatibility with Hono.js, aligning with your prior interest in file upload solutions. Perfect for uploading product images for e-commerce or profile pictures for social media.
- Secure by Default
Built-in security measures and validation
- File Type Validation
Automatic file type and size validation
- Access Control
Fine-grained permissions and access control
- Simple API
Intuitive API design with minimal setup
- TypeScript Support
Full TypeScript support with type safety
- React Components
Pre-built components for quick integration
- • Product image uploads
- • Multiple product photos
- • Category banners
- • User-generated content
- • Profile pictures and avatars
- • Post images and media
- • Story content
- • Cover photos
Installation
npm install @uploadthing/react
Backend Route Example
// In your Hono.js API
app.post('/api/upload', async (c) => {
// Handle file upload with UploadThing
const result = await uploadFiles(files)
return c.json({ success: true, urls: result })
})
React Native Component
import { UploadButton } from '@uploadthing/react-native'
<UploadButton
endpoint="imageUploader"
onClientUploadComplete={(res) => {
console.log("Files: ", res)
}}
/>