dimanche 31 août 2014

Ruby on Rails: How would I access this Carrierwave @original_filename params?


Vote count:

0




I'm currently using Carrierwave and want to be able to save the original filename as my model Document's title. I see that when I submit the document uploader form, the filename is saved as @original_filename.


How would I access this? I tried params[:document][:attachment][:original_filename] , but the "@" is what's confusing me.


Also, the main reason why I want to save the filename as a hard title is because if I use Document.attachment.file.filename, it sometimes shows as "6sw=&Expires=1409522546" instead of the filename, probably because of the random extensions that get added when the file gets uploaded to S3


Parameters:


{"utf8"=>"✓", "authenticity_token"=>"f67R1N2JR0b4WDWeYfSzI8q3DKwK59y487TXhR4xYvo=", "document"=>{"attachment"=>#, @original_filename="1 documents.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"document[attachment]\"; filename=\"1 documents.png\"\r\nContent-Type: image/png\r\n">}, "commit"=>"Upload Files"}



asked 2 mins ago







Ruby on Rails: How would I access this Carrierwave @original_filename params?

Aucun commentaire:

Enregistrer un commentaire