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 8814847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:13:52+00:00 2026-06-14T04:13:52+00:00

I’m going crazy to upload a file into my ruby 3.2.8 application. I need

  • 0

I’m going crazy to upload a file into my ruby 3.2.8 application. I need your help! I tried this code:

Why yaml file upload does not work? I think permission problems

but it does not work, does not create the file in “public”, but only creates the temporary file. Today I found a new way:

Rails 3 – upload files to public directory

So, View:

<p style="color: green"><%= flash[:notice] %></p>

<%= form_for :uploadFile, :url => "/upload/uploadfile", :html => { :multipart => true } do |f| %>
  <label for="uploadFile">Select File:</label>
  <%= f.file_field :upload %>
  <%= f.submit "Upload", :disable_with => 'Uploading...' %>
<% end %>

Controller:

class UploadController < ApplicationController
  def uploadFile
    require 'fileutils'
    tmp = params[:uploadFile][:upload].tempfile
    file = File.join("public", params[:uploadFile][:upload].original_filename)
    FileUtils.cp tmp.path, file
    flash.now[:notice]="File has been uploaded successfully"
  end
end 

but same problem. in “public” there is no file 🙁

Logs says:

Started POST "/upload/uploadfile" for 127.0.0.1 at 2012-11-12 11:19:04 +0100
Processing by UploadController#uploadfile as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"WI23X2HeanJpQJoRFc8NUJ078yLYpKgRE3VnJDBeccA=", "uploadFile"=>{"upload"=>#<ActionDispatch::Http::UploadedFile:0x47e4238 @original_filename="newCases.yml", @content_type="application/octet-stream", @headers="Content-Disposition: form-data; name=\"uploadFile[upload]\"; filename=\"newCases.yml\"\r\nContent-Type: application/octet-stream\r\n", @tempfile=#<File:C:/Users/Simo/AppData/Local/Temp/RackMultipart20121112-4716-1geiytj>>}, "commit"=>"Upload"}
  [1m[36mSetting Load (0.0ms)[0m  [1mSELECT "settings".* FROM "settings" WHERE "settings"."id" = ? LIMIT 1[0m  [["id", 1]]
  Rendered upload/uploadfile.html.erb within layouts/upload (0.0ms)
Completed 200 OK in 16ms (Views: 0.0ms | ActiveRecord: 0.0ms)

ahh, the upload file is yaml, change anything?

My gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.8'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

gem "comma", "~> 3.0.3"
gem 'fastercsv', '1.5.4'
  • 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-14T04:13:53+00:00Added an answer on June 14, 2026 at 4:13 am

    Maybe adding :url to form_for like

    form_for :uploadFile, :url => "/upload/uploadfile"
    

    will help?
    With rails 3.2.8 your uploading works fine, except I added :url parameter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.