Skip to content
Discussion options

You must be logged in to vote

Yeah, the memory storage cannot retrieve the path, because the uploaded file doesn't exist on the filesystem. You'll need to create a conditional for memory storage, something like:

class ApplicationController < ActionController::Base
  private

  def send_upload(uploaded_file, ...)
    if uploaded_file.storage.is_a?(Shrine::Storage::Memory)
      send_file uploaded_file.download.path, ...
    else
      send_file uploaded_file.to_io.path, ...
    end
  end
end
# in your controller:
send_upload(resume.file)

You could also use send_data uploaded_file.read, ... for the memory storage path.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by dmitry
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants