How to get the filename of uploaded file in rails contoller
问题 <%= file_field 'upload' %> In my controller, if I give the following, based on suggestions filename=params[:upload] @result=filename.original_filename I am getting. undefined method `original_filename' for #<ActionController::Parameters:0x002b6c396e44b8> Note: I am not using form. Rails version is 4.0.2 回答1: Use the following code in order to get the filename: params[:file].original_filename 回答2: Have you read how to upload files in Rails? Have you set your form to multipart: true ? What will