user1684535
user1684535

Reputation: 75

File field tag is not displaying value in the browser

I am using the following line in my .html.erb file

<@= file_field_tag 'file', :class => 'upload', value => 'index.html' %>

When it is rendered in the browser, it is not displaying the value 'index.html'.

Can someone help me in figuring out how to display the value.

Upvotes: 1

Views: 2857

Answers (1)

Shadwell
Shadwell

Reputation: 34774

You can't set a value on a file input in HTML. Therefore you can't do it via rails too.

Otherwise you could set the value in your page and submit the form via javascript and pluck files from your visitors computers.

Upvotes: 2

Related Questions