Premium
S3 temporary file cleanup
Chunked uploads land under a temporary prefix first; what removes them afterwards is S3's own lifecycle policy, not the application.
How a file leaves the temp prefix
| Situation | What removes the object |
|---|---|
| The record is saved | The file is server-side copied to its final key; the temp original is left to the lifecycle rule |
| The user cancels | The abort endpoint deletes the object and cancels the multipart upload |
| The form is abandoned | Nothing — the object stays until the lifecycle rule expires it |
Required lifecycle rules
Two rules on the bucket:
- Expire objects under
tmp_prefixafter a short period — one day is enough, since a file that has not been saved by then never will be. - Abort incomplete multipart uploads after the same period, otherwise their parts are stored and billed without ever appearing as an object.
caution
Without these rules abandoned uploads accumulate silently: they are not visible as records, and incomplete multipart parts are not visible in the bucket listing at all.
See also
- Configuration — where
tmp_prefixis set - Provider selection — the tus alternative and its own TTL