質問

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.

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top