From e4e71541e7797e5e4bcdbcb8997715066c82996b Mon Sep 17 00:00:00 2001 From: Sdogruyol Date: Sat, 11 Feb 2017 16:54:19 +0300 Subject: [PATCH] Update CHANGELOG --- CHANGELOG.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdd9b2c..5a2e214 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,41 @@ +# 0.18.0 (11-02-2016) + +- Simpler file upload. File uploads can now be access from `HTTP::Server::Context` like `env.params.files["filename"]`. + +`env.params.files["filename"]` has 5 methods + +- `tmpfile`: This is temporary file for file upload. Useful for saving the upload file. +- `tmpfile_path`: File path of `tmpfile`. +- `filename`: File name of the file upload. (logo.png, images.zip e.g) +- `meta`: Meta information for the file upload. +- `headers`: Headers for the file upload. + +Here's a fully working sample for reading a image file upload `image1` and saving it under `public/uploads`. + + ```crystal +post "/upload" do |env| + file = env.params.files["image1"].tmpfile + file_path = ::File.join [Kemal.config.public_folder, "uploads/", file.filename] + File.open(file_path, "w") do |f| + IO.copy(file, f) + end + "Upload ok" +end + ``` + +To test + +`curl -F "image1=@/Users/serdar/Downloads/kemal.png" http://localhost:3000/upload` + +- RF7233 support a.k.a file streaming. (https://github.com/kemalcr/kemal/pull/299) (thanks @denysvitali) + +- Update Radix to 0.3.7. Fixes https://github.com/kemalcr/kemal/issues/293 +- Configurable startup / shutdown logging. https://github.com/kemalcr/kemal/issues/291 and https://github.com/kemalcr/kemal/issues/292 (thanks @twisterghost). + +# 0.17.5 (09-01-2016) + +- Update multipart.cr to 0.1.2. Fixes #285 related to multipart.cr + # 0.17.4 (24-12-2016) - Support for Crystal 0.20.3