Storing attachments | laravel-webhook-client-rust | Spatie       

 SPATIE  

  Laravel Webhook Client Rust 
==============================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-webhook-client-rust](https://spatie.be/docs/laravel-webhook-client-rust/v1)  Storing attachments

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-webhook-client-rust/v1) 

  Storing attachments    
- [ Introduction ](https://spatie.be/docs/laravel-webhook-client-rust/v1/introduction)
- [ Support us ](https://spatie.be/docs/laravel-webhook-client-rust/v1/support-us)
- [ Installation and setup ](https://spatie.be/docs/laravel-webhook-client-rust/v1/installation-and-setup)
- [ Usage ](https://spatie.be/docs/laravel-webhook-client-rust/v1/usage)
- [ Customizing the package ](https://spatie.be/docs/laravel-webhook-client-rust/v1/customizing-the-package)
- [ Storing attachments ](https://spatie.be/docs/laravel-webhook-client-rust/v1/attachments)
- [ Testing ](https://spatie.be/docs/laravel-webhook-client-rust/v1/testing)
- [ Changelog ](https://spatie.be/docs/laravel-webhook-client-rust/v1/changelog)

 Storing attachments
===================

Laravel extracts multipart uploads to temporary files. Validate your endpoint's upload fields with Laravel's `UploadedFile` type, then turn each upload into an `Attachment` using `Attachment::from_upload(&file).await`. Pass the resulting slice to `processor.process_with_attachments(request, &attachments).await`.

The package stores the original filename, detected MIME type, byte length and base64 content in the dedicated attachments column. Nested or repeated upload fields can be flattened into this slice. Your custom model can keep field names or other metadata when needed. `Attachment::bytes()` restores the bytes without leaking a temporary file. Treat filenames as untrusted metadata, never filesystem paths.

Set `config.store_attachments = false` to omit attachments from storage. Files remain separate from `payload`, so an ordinary input field called `attachments` is never overwritten.

The framework's public request API does not enumerate arbitrary upload fields. An application therefore declares the upload shape using native validation, rather than having this package guess it. Laravel does not retain a multipart body's original bytes. Use a sender-specific signature validator that authenticates its documented multipart signature or authorization header; the default body HMAC validator rejects requests without original bytes.

Keep Laravel's upload and request-size limits enabled. Base64 adds about a third to stored content size. Do not accept unbounded uploads.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
