fix upload file example in changelog (#504)
This commit is contained in:
parent
22a2a69d65
commit
4ccea8d6a1
1 changed files with 4 additions and 4 deletions
|
@ -9,16 +9,16 @@
|
|||
|
||||
Here's a fully working sample for reading a image file upload `image1` and saving it under `public/uploads`.
|
||||
|
||||
```crystal
|
||||
```crystal
|
||||
post "/upload" do |env|
|
||||
file = env.params.files["image1"].tmpfile
|
||||
file_path = ::File.join [Kemal.config.public_folder, "uploads/", file.filename]
|
||||
file = env.params.files["image1"].tempfile
|
||||
file_path = ::File.join [Kemal.config.public_folder, "uploads/", File.basename(file.path)]
|
||||
File.open(file_path, "w") do |f|
|
||||
IO.copy(file, f)
|
||||
end
|
||||
"Upload ok"
|
||||
end
|
||||
```
|
||||
```
|
||||
|
||||
To test
|
||||
|
||||
|
|
Loading…
Reference in a new issue