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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:58:58+00:00 2026-05-30T12:58:58+00:00

I’ve been trying to do simple file uploads but I am unable to find

  • 0

I’ve been trying to do simple file uploads but I am unable to find a gem that does it, all of them just seem to be orientated around
images. I just want basic .zip file uploads. Could someone instruct me to a gem that does this or a tutorial that builds your own custom
uploads. However, if there are none, I’ll create my own file uploading, but then I am faced with the following question

The question:

How do I store the file’s path in the database when the user hits the upload button?

Below is the scenario:

The form consists of the following:

Title box:
File select box:
Upload button:

The database table just consists of two columns, the title (Title) and the file's path (FilePath) on the filesystem

The user fills in the title, browses for the file on their system, and clicks on the upload button, the file then needs
to be stored on the disk, lets say /public/uploads/file1.zip while also writing to the mysql database the Title of the upload as well as
the path to the actual file that resides now in /public/uploads/file1.zip.

On another page, I can simply just query the database to retrieve the Title and FilePath which will display the Title and a link/path to the file that a user can simply just click on and download.

It will be displayed on the page as follows:

Title – Download

so i.e Conference Document for the 27th – Download

Where “Title” = user submitted file title and “Download” = the actual link you can click on that will retrieve the file from the disk
and start downloading. This needs to be one query from the database that retrieves the title and the path to the file. The querying
part I know how to do. It’s just the part of uploading the file to that directory, storing the directory for that specific file in the database and it’s Title the user submitted.

Any suggestions, examples and resources will be greatly appreciated. Thanks for your time.

  • 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-30T12:58:59+00:00Added an answer on May 30, 2026 at 12:58 pm

    Read uploading files from the rails guides and then read the CarrierWave README. Basically it’s:

    # in the model
    mount_uploader :archive, ArchiveUploader, mount_on: :archive_path
    
    # in the controller action
    @record = YourModel.new(params[:record]) # moves the file from server upload path to CW cache dir
    @record.save # moves the file from CW cache dir to final fs dir, and stores path in mounted_on column
    
    # in the form
    <%= f.file_field :archive %>
    
    # in the view
    <%= link_to 'Download', @record.archive_url %>
    

    The filesystem path will be stored in the table column you mount on.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I have a French site that I want to parse, but am running into
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.