bigpotato
bigpotato

Reputation: 27507

Rails: Change "Choose file" to "Browse"

I'm trying to make a file field for uploading images. However, mine has a "Browse" while a tutorial I'm watching has "Choose File".

My code for the file_field looks the same though. Can someone explain whether there's a difference? I'm trying to hook it up to AJAX to show my uploaded results without refreshing the page, so I'm not sure if that's possible with the "Browse" button.

my form:

<%= form_for([@user, @album, @photo], :html => { :multipart => true }) do |f| %>

<%= f.file_field :avatar, multiple: true, name: "photo[avatar]" %>

<% end %>

Upvotes: 0

Views: 1770

Answers (2)

cih
cih

Reputation: 1980

Its just a browser/os thing, you can change it with javascript/jquery by hiding the button and creating another, there are a number of techniques for this...

You should take a look at this railscast its a good way to upload files with ajax/jquery

Upvotes: 1

Michael Durrant
Michael Durrant

Reputation: 96484

That's just the native OS part of selecting the file so you are likely just seeing differences between mac / linux / Windows. Which are you on? It should not affect the functionality you are seeking.

Upvotes: 3

Related Questions