Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8049701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:51:22+00:00 2026-06-05T06:51:22+00:00

<%= form_for @model_name, :url => {:controller => ‘controller_name’, :action => ‘index’},:html => {:multipart =>

  • 0
<%= form_for @model_name, :url => {:controller => 'controller_name', :action => 'index'},:html => {:multipart => true},:validate => true do |f| %>

<%= file_field 'upload', 'datafile'%>

<% end %>

I have this form. I want to upload only images through this upload. How to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:51:24+00:00Added an answer on June 5, 2026 at 6:51 am

    You can use paperclip gem to manage file attachments. It has validates_attachment validator which would be helpful.

    validates_attachment :avatar, :presence => true,
      :content_type => { :content_type => "image/jpg" },
      :size => { :in => 0..10.kilobytes }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the form for comment: echo $this->Form->create('Comment',array('url'=>array('controller' => 'comments', 'action' =>'add', $listposts['Post']['id']) )
i have a form like this: <%= form_for @group, :url => { :controller =>
I'm passing 2 hardcoded parameters to an ASP.Net MVC2 Controller Action with this code:
View <%= form_for @product, :url => admin_products_path do |f| %> <div> <%= f.label :name
I would like to use the form_for helper multiple times for the same model
I am trying to save a model named 'customer' using form_for tag. I do
I'm trying to create a form_for using the following fields. However, some of the
I have a model (Project), in the 'new' action I have this code <h1>Create
I have a model (Project), in the 'new' action I have this code <h1>Create
I have a problem with simple form for, I get this error url(http://localhost:3000/konkurrencer/new): Showing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.