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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:24:26+00:00 2026-06-07T06:24:26+00:00

I would like to have the user upload a file inside a form and

  • 0

I would like to have the user upload a file inside a form and upon submission, open the file and read each line in order to grab information from it to store in the database. So far I am only able to make an object and extract bytes from it.

def  uploadedFile = request.getFile('name_of_file')

This gets me a commonsMultipartFile, but I am not sure if I need to stream the file into a buffer, or save the file into a temp folder and then try to open it that way.

uploadedFile.getbytes() will give me an array [71, 101, 110, 101, 114, 97, 108, 13, 10, 45, 45, 45, 45, 45, 45, 45, 13, 10, 83, 116….] which is not in a form I can do anything with.

I need to be able to open the file and read it line by line. Can I do that with the commonsMultipartFile – its options seem kind of limited.

  • 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-07T06:24:28+00:00Added an answer on June 7, 2026 at 6:24 am

    The CommonsMultipartFile has a getInputStream() method which will return an InputStream on which you can call any Groovy enhancements, for example:

    request.getFile('name_of_file').inputStream.eachLine { line ->
        /* Parsing logic */
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file upload form on my website and would like to add
I have a form with file upload capabilities and I would like to be
I would like to have the user upload a pdf to a folder on
I would like for a user to upload an image to a file in
Still an iphone dev starter but trying. I would like to have the user
I would like to have the page on user/sidebar on the right in the
I would like to have a text field that a user can enter a
I would like to have a checkbox preference that takes the user to a
I would like to make my user control have invisible areas like the areas
I have a MySQL user added to a database that I would like 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.