2014-03-28 1 views
1

나는 파일을 업로드하고 다음 PARAMS 요청하는 경우 :어떻게이 ActionDispatch에서 파일 이름을 얻을 수 있습니다

params[:product][:images_attributes]["0"][:image] 

가 반환

#<ActionDispatch::Http::UploadedFile:0x007fcbe5c8f768 @original_filename="motorized-bicycle-9.jpeg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"product[images_attributes][0][image]\"; filename=\"motorized-bicycle-9.jpeg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/var/folders/qf/gjxv0pl142scx9131j0k65_00000gs/T/RackMultipart20140328-969-12np4s4>> 

내가 할 때 사용하는 루비 코드 무엇입니까 filename을 받으시겠습니까?

+1

이 params [: product] [: images_attributes] [ "0"] [: image] .original_filename' –

+0

@ product.description.file.filename은 인간화 된 파일 이름을 제공합니다. –

답변

관련 문제