File Upload
File uploading is very simple. Files are detected and turned into Amber::Router::File
and put into a temporary file cache.
You can access files from the params
macro using the files
method.
This will return a Hash(String, Amber::Router::File)
object that you can work with. The attributes you can access are:
For example, let's say we have a controller with a create
method that we want someone to POST
a JSON body that includes a file to upload:
First you need an amber project generated with Amber CLI or from scratch.
You still require a form to upload your file, see views. Also see request and response.
Last updated