Skip to content

v0.25.0

Compare
Choose a tag to compare
@sdogruyol sdogruyol released this 04 Nov 23:31
· 111 commits to master since this release
  • Crystal 0.27.0 support.

  • [breaking change] Added back env.params.files.

Here's a fully working sample for reading a image file upload image1 and saving it under public/uploads.

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

  • Cache HTTP routes to increase performance 🚀 #493