I've uploaded a file using active_scaffold and paperclip, passing through update action, but don't know how to extract the params

111 views Asked by At

I've uploaded a file using active_scaffold and paperclip, passing through update action, but don't know how to extract the params

How am I supposed to get the origin_filename? There are some keyword converting problem so I have to show it by image.

Here is what I tried:

params[:excel].tempfile
params[:excel].original_filename 
params[:excel][:filename]

The params content:

enter image description here

1

There are 1 answers

0
spickermann On

You are almost there, but your file is nested in params[:record]:

file = params[:record][:excel]
file.original_filename

Further read: Rails Guide about uploading files