LoginSignup
0
0

More than 3 years have passed since last update.

[Rails] 画像ファイルを受け取って保存する

Posted at

Progate学習メモ

view.rb
<input name="image" type="file">
controller.rb
image = params[:image]
# File.binwrite("path_to_画像ファイルを保存するフォルダ/画像ファイル名", 画像データ.read)
File.binwrite("public/user_images/#{@user.image_name}", image.read)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0