1

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.

deefour
  • 34,974
  • 7
  • 97
  • 90
user1684535
  • 75
  • 1
  • 2
  • 8
  • possible duplicate of [Set default value for a input file form](http://stackoverflow.com/questions/2665058/set-default-value-for-a-input-file-form) – deefour Nov 15 '12 at 14:59
  • possible duplicate of [Dynamically set value of a file input](http://stackoverflow.com/questions/1017224/dynamically-set-value-of-a-file-input) – Thilo Nov 19 '12 at 23:13

1 Answers1

2

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.

Shadwell
  • 34,314
  • 14
  • 94
  • 99