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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:54:54+00:00 2026-05-12T23:54:54+00:00

Uploading a file in PHP results in a map. One of the keys, tmp_name,

  • 0

Uploading a file in PHP results in a map. One of the keys, tmp_name, allows the user to manipulate the file without having to move it around. I’d like to do the same for Ruby on Rails.

I have a form that takes a .csv file. With this, I’m trying to populate a database. However using just the file field from the form, I get a type of ActionController::UploadedFile which doesn’t allow me to do CSV.open or iterate over it. So how can I access the file uploaded without moving it into my project and then iterate over it? Thanks.

  • 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-12T23:54:54+00:00Added an answer on May 12, 2026 at 11:54 pm

    The method ActionController::UploadedFile#path should return the path of the tmp file on the server. You also have a handy #read method that returns the content of the file.

    file_param = params[:upload][:file]
    filename = file_param.original_filename
    filename = file_param.path
    filedata = file_param.read
    
    CSV.open(file_param.path, "r") { ... }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 files namely: uploading.php emaillinks.php both include a file inc.php which has
Can you run some script before the uploading of a file starts in php?
I am running Ubuntu8.041. Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.3 with Suhosin-Patch configured Can't get file uploading
i am having an form for uploading an excel file like <form enctype=multipart/form-data action=http://localhost/joomla/Joomla_1.5.7/index.php?option=com_jumi&fileid=7
While user uploading a file, is it possible to know if the uploaded file
I have a php file for uploading a picture (it uploads the picture, creates
I am uploading a file in cake php. <?php echo $form->create(Video,array('action'=>'add','name'=>'thisform','enctype'=>'multipart/formdata','onsubmit'=>'javascript: return validate();')); echo
I want to get a reasonably large file (around 45-50M) from user of my
My PHP book gives a template HTML form for uploading a file: <form action=upload.php
Can someone please advise on uploading a file using the DAV protocol in PHP?

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.