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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:03:46+00:00 2026-05-23T17:03:46+00:00

I have put a file_field in my view : <% form_for(:uploaded_file, @feed, :url =>

  • 0

I have put a file_field in my view :

<% form_for(:uploaded_file, @feed, :url => {:action=>'copy'}, :html=> {:multipart=>true}) do |f| %>
<%= f.file_field :uploaded_file %> <br>
<%= f.submit "Submit" %>
<% end %>

And I have a method in my controller that reads a Excel file:

def copy
    file = ""
    book = Spreadsheet.open 'excel_file'
    table = book.worksheet 'excel_sheet'
    table.each do |row|
      file << row
    end
end

Log with request

"authenticity_token"=>"BbQRomTLhiF2O54/G6eHwnnaWbLttUSvo31FO3ZtKoA=", 
"uploaded_file"=>{"uploaded_file"=>#<ActionDispatch::Http::UploadedFile:
 0x27b7ab‌​0 @original_filename="test.xlsx",@content_type="application
 /vnd.openxmlformats-officedocument.spreadsheetml.sheet", @headers=
 "Content-Disposition: form-data; name=\"uploaded_file[uploaded_file]\";
 filename=\"volumetrie.xlsx\"\r\nContent-Type: application/vnd.openxmlformats
 officedocument.spreadsheetml.sheet\r\n", @tempfile=#<File:C:/DOCUME~1/me/
 LOCALS~1/Temp/RackMultipart20110714-524-fy6vu>>}, "commit"=>"Submit"} 

I’m just trying to get the path of my selected file to insert it in my Spreadsheet.open method. The error message is : No such file or directory.

Instead of 'excel_file' that is the path of my Excel file, I would like to use the path of the file that I have choosed in the file_field in my view. How can I use this parameter ?

Thank you !

  • 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-05-23T17:03:46+00:00Added an answer on May 23, 2026 at 5:03 pm

    You can’t get path to file from form in modern browsers. You can work only with tempfile Should be available as params[ :uploaded_file ][ :tempfile ]

    Edit try

    file = Spreadshet::Excel.new('params[ :uploaded_file ][ :filename ]', 'w+')
    file.write( params[ :uploaded_file ][ :tempfile ].read )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code in view <% uberform_for :profile, :html => { :multipart => true,
I currently have a form like this: <% form_for @stem, :html => {:multipart =>
Do developers have to put certain/extra elements in the feed's XML file or attributes
I have a button_to that I want to perform a PUT action (there is
Do I have to put every file in a different folder? like: about-us/about-us.php profile/profile.php
I developed an EAR using Quartz API. I have put my quartz.properties file in
I have to put in a bash variable the first line of a file.
My current situation is: I have to read a file and put the contents
I have tried to put <a href=page2.hta>Go Page 2</a> inside a .hta file. However,
I have a file containing lots of data put in a form similar to

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.