ruby on rails - Why do i get 'no implicit conversion of ActionController::Parameters into String' when I pass a parameter to session.upload_from_file -
i developing tool uploads file google drive. using 'google-drive' gem.
in view have taken as
<%= file_field :file, class: 'form-control' %> <br> i call method in controller form passes params[:file]
session = googledrive::session.from_config("config.json") session.upload_from_file(params[:file], "right-on.txt", convert: false) but on submit - no implicit conversion of actioncontroller::parameters string.
how pass file uploaded google drive. if pass local file path instead of params[:file], file gets uploaded sucessfully. have file selection.
check if multipart set 'true' in form tag.
if not, set true.
and instead of passing params[:file], pass params[:file].path.to_s
the upload function expecting string path. params[:file] file gets stored in temp folder while uploading. check once without using to_s.
this should help.
Comments
Post a Comment