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

  • SEARCH
  • Home
  • 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 8919647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:05:01+00:00 2026-06-15T06:05:01+00:00

I am trying to set up an upload image page where the user can

  • 0

I am trying to set up an upload image page where the user can optionaly upload
an image url instead. I am using carrierwave
The view:

<%= form_for @rating, :html => {:multipart => true} do |f| %>

    <p>
      <%= f.file_field :pic_url %>
    </p>

    <p>
      <%= f.label :remote_pic_url_url, 'or image url' %>
      <br/>
      <%= f.text_field :remote_pic_url_url %>
    </p>

    <div class="actions">
      <%= f.submit 'Upload Picture', :class => 'btn btn-primary' %>
    </div>

the model:

class Rating < ActiveRecord::Base
  attr_accessible :pic_url, :remote_pic_url_url, :rating

  mount_uploader :pic_url , ImageUploader
end

when I try to input just the image url, I get a error msg:
Pic url You are not allowed to upload "" files, allowed types: jpg, jpeg, gif, png

How do I make that field optional. I was under the impression that remote_{columnName}_url is the convention for adding additional url field in carrierwave, and that will take care of that for me..

controller code:

# POST /ratings
  # POST /ratings.json
  def create
    @rating = Rating.new(params[:rating])

    respond_to do |format|
      if @rating.save
        format.html { redirect_to @rating, :notice => 'Rating was successfully created.' }
        format.json { render :json => @rating, :status => :created, :location => @rating }
      else
        format.html { render :action => "new" }
        format.json { render :json => @rating.errors, :status => :unprocessable_entity }
      end
    end
  end
  • 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-15T06:05:02+00:00Added an answer on June 15, 2026 at 6:05 am

    See this thread.

    The error you’re getting (You are not allowed to upload "" files, allowed types: jpg, jpeg, gif, png) is the same one you get with the following:

    @rating.remote_pic_url_url = "http://www.google.com"
    @rating.save
    

    The problem here is that Carrierwave opens the URL, then calls the resulting file with base_uri.path, which returns /, hence the error. If you were entering a URL which has no extension, then this is the cause.

    If not, then I’m not sure why it’s not working. I use the same approach in my own project (i.e. setting remote_{columnname}_url and then saving the record) and it works fine. Although I don’t normally use the extension whitelist validator, I added one and (in the console at least) it works fine as well with valid URLs (i.e. URLs pointing to images with valid extensions).

    Can you try the steps below in the console and see if it saves properly? (insert some valid URL to a JPG/GIF/PNG file):

    @rating = Rating.new(remote_pic_url_url: 'http://...')
    @rating.save
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to set up a web page where trusted users can upload
I'm trying to set a site up so I can upload images using a
I am trying to set a default image for my image upload form. In
I'm trying to upload an image to dropbox. I'm using the latest version of
I am trying to upload an image using django and following a tutorial from
i'm trying to create form which with which i can upload text and image
Trying to upload files using Google Gears and ASP.NET... I assume you can as
I'm trying to upload an image using Codegniter's Upload Library, the image should be
I'm using a REST API in Codeigniter and trying to set up an image
I'm trying to upload an image via the Django admin and then view that

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.