---
title: Formbricks Seafile Image Upload
overview: Skill for handling image uploads to Seafile when creating Formbricks surveys, including fallback strategies when Seafile authentication fails.
name: formbricks-seafile-image-upload
description: Complete workflow for uploading images to Seafile when creating Formbricks surveys, with authentication troubleshooting and multiple fallback strategies for when Seafile fails.
---

# Formbricks Seafile Image Upload Skill

## Context
When creating Formbricks surveys that require image assets (like exercise diagrams for medical conditions), images need to be hosted somewhere accessible. Seafile was the intended hosting solution but authentication challenges require fallback strategies.

## Prerequisites
- Formbricks Management API configured with:
  - Base URL: https://form.140103.xyz
  - API Key: 33513637d4161852807df0eeb734da61
  - environmentId: cmlw3055s0008xh6f9aod3sko
- Seafile server configured at: https://ftp.140103.xyz
- Local image files available for upload

## Workflow

### 1. Primary Approach: Seafile Upload
```bash
# Get upload link
curl -s \
  -H "Authorization: Token YOUR_TOKEN" \
  "$SEAFILE_URL/api2/repos/$REPO_ID/upload-link/?p=/"

# Upload file
curl -X POST "upload-link" \
  -H "Authorization: Token YOUR_TOKEN" \
  -F "file=@local/path.jpg" \
  -F "parent_dir=/" \
  -F "replace=1"
```

### 2. Authentication Troubleshooting
If Seafile authentication fails:
```bash
# Try getting new token
curl -X POST "$SEAFILE_URL/api2/auth-token/" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "username=admin@formbricks.com&password=formbricks123"

# Verify token validity
curl -s "$SEAFILE_URL/api2/repos/" \
  -H "Authorization: Token YOUR_TOKEN"
```

### 3. Fallback Strategies When Seafile Fails

#### Option A: Local File Sharing
- Provide direct file paths for manual download
- Use SCP/SFTP for secure transfer
- Create ZIP archive for bulk download

#### Option B: Alternative File Sharing Services
```bash
# file.io (temporary)
curl -F "file=@local/path.jpg" https://file.io

# transfer.sh (if available)
curl --upload-file local/path.jpg https://transfer.sh/path.jpg

# catbox.moe (for images)
curl -F "reqtype=fileupload" -F "fileToUpload=@local/path.jpg" https://catbox.moe/user/api.php
```

#### Option C: Direct URL Hosting
- Use existing web hosting services
- Upload to GitHub Pages
- Use cloud storage with public links

## Error Handling

### Common Seafile Errors
- **401 Invalid token**: Re-authenticate or use backup token
- **404 Repository not found**: Verify REPO_ID is correct
- **500 Server error**: Check Seafile server status

### Fallback Triggers
Switch to fallback when:
- Seafile authentication fails 3+ times
- API returns 401/403 consistently
- Server response time > 5 seconds

## Integration with Formbricks

### Image URL Format for Formbricks
```
https://seafile.example.com/d/SHARE_CODE/files/?p=/path/to/image.jpg&dl=1
```

### Survey Creation with Images
1. Upload images first
2. Get public URLs
3. Create Formbricks survey with image URLs
4. Test survey rendering

## Best Practices

1. **Always verify authentication** before bulk operations
2. **Have multiple fallback options** prepared
3. **Test image accessibility** after upload
4. **Document token rotation** procedures
5. **Keep local copies** of important assets

## Example Use Case
Creating a "Lumbar Muscle Strain Exercises" survey:
1. Download exercise images from Bing
2. Upload to Seafile (primary) or file.io (fallback)
3. Create Formbricks survey with image URLs
4. Provide both direct file access and survey link to user

## Notes
- Seafile token format: "Token YOUR_TOKEN"
- Repository ID must be correct for API calls
- Some file sharing services have size limits
- Temporary services may delete files after time limit
- Always verify final image URLs work in Formbricks