Image upload in rails not working
i need to upload one image and send that into one api,here not using the database.i have used this file upload without activerecord activerecord but not working. it gives the error with orginal_filename? this is what i am getting when i use this
file_param = params[:name] file_name = file_param.original_filename NoMethodError (undefined method `original_filename' for "C:\\fakepath\\logo-big.png":String):
Isn't it a good idea to use gem carrierwave. Here is an awesome tutorial. Check it out.
if your view something like this: <%= file_field_tag 'upload[file]' %>
change your controller code to this:
file_name = params[:upload][:file].original_filename