I'm using an AJAX uploader in Rails 3, along with paper_clip and have files uploading here:
def upload
@photo = Photo.create({ :photo => params[:file], :title => params[:filename] })
respond_to do |format|
format.json
end
end
I want to set the photo's title as the photo's filename, but don't know how to, even though params[:file] does have the file and is being uploaded to S3.
Any ideas?
Thanks
params[:file].original_filename
has the filename you are looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With