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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:27:00+00:00 2026-06-14T00:27:00+00:00

I would like to load in the config directory, a yaml file chosen by

  • 0

I would like to load in the config directory, a yaml file chosen by the user.
I have a view:

<h1>File Upload</h1>
<p>Upload your Yaml Configuration File</p>

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

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

  <label for="upload_file">Select File:</label>
  <%= f.file_field :upload %>
  <%= f.submit "Upload", :disable_with => 'Uploading...' %>
<% end %>

and I have a controller:

class UploadController < ApplicationController
def uploadFile
    uploaded_io = params[:uploadFile][:upload]
    File.open(Rails.root.join('public', uploaded_io.original_filename), 'w') do |file|
        file.write(uploaded_io.read)
    end

    flash.now[:notice]="File has been uploaded successfully"

end
end

When the user selects the file and press “upload” nothing happens and the file is not in the config folder. What can I do? Maybe I should use “import yaml” and load it in a certain way, how?

The log said this:

Started POST "/upload/uploadfile" for 127.0.0.1 at 2012-11-08 10:51:46 +0100
Processing by UploadController#uploadfile as HTML
  Parameters: {"utf8"=>"✓",  "authenticity_token"=>"5FKgZJG4gKPCHXe8OqhFVZL0bu2X9zLR3sxd4ELBulA=", "uploadFile"=>{"upload"=>#<ActionDispatch::Http::UploadedFile:0x3b03ad8 @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/RackMultipart20121108-2664-tb7lxr>>}, "commit"=>"Upload"}
  [1m[35mSetting Load (0.0ms)[0m  SELECT "settings".* FROM "settings" WHERE "settings"."id" = ? LIMIT 1  [["id", 1]]
  Rendered upload/uploadfile.html.erb within layouts/upload (0.0ms)
Completed 200 OK in 0ms (Views: 0.0ms | ActiveRecord: 0.0ms)
  • 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-14T00:27:01+00:00Added an answer on June 14, 2026 at 12:27 am
    File.open(Rails.root.join('config', uploaded_io.original_filename), 'wb+') do |file|
        file.write(uploaded_io.read)
    end
    

    Try this instead

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

Sidebar

Related Questions

I would like to load some data stored in a file into my mysql
$('#selector').click(function() { // here I would like to load a javascript file // let's
I have an assembly I would like to load from a sub-folder of the
I have requirement where some times I would like to load children as well
I have several PDF templates that I would like to load and modify and
I have a C# .Net 2.0CF application where I would like to load a
I have been toying with the modulino perl pattern and would like to load
I have a rewrite rule in my web.config file like this: <rule name=Public page
We have a website that we would like to extrapolate user controls from and
I would like to load a .py file at runtime. This .py file is

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.