3

Having the following form:

= form_for company, html: { multipart: true } do |form|
    = form.label :logo, 'Upload Image'
    = form.file_field :logo

I want to set file_field value to another user uploaded image (have the object of ActionDispatch::Http::UploadedFile class). Is there a way to do it?

1 Answer 1

1

You cannot set the value for the file field and its because of security.

e.g would you want websites on the internet to be able to automatically set a value of C:/some_secret_folder/password.txt to a file field and submit the form through JS ?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.