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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:37:43+00:00 2026-05-27T10:37:43+00:00

How do I convert an uploaded file from apache’s UploadedFile class to a java.io.File

  • 0

How do I convert an uploaded file from apache’s UploadedFile class to a java.io.File class?

  • 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-27T10:37:44+00:00Added an answer on May 27, 2026 at 10:37 am

    Looking at the documentation (UploadedFile and File) for both classes, here’s one solution.

    Since you can access the InputStream of the UploadedFile, you can read in the data of the uploaded file and write it to a temporary location or another location that your application can manage.

    // assume that you have the UploadedFile object named uploadedFile
    InputStreamReader reader = new InputStreamReader(uploadedFile.getInputStream());
    int partition = 1024;
    int length = 0;
    int position = 0;
    char[] buffer = new char[partition];
    FileWriter fstream = new FileWriter("out.tmp");
    do{
        length = reader.read(buffer, position, partition)
        fstream.write(buffer, position, length);
    }while(length > 0);
    File file = new File("out.tmp");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are using sp's to convert a uploaded file into corresponding master values and
I am writing a PHP page to convert an uploaded file to XML. I
First,I uploaded a file in a external server and got a url from that
I have browsed and uploaded a png/jpg file in my MVC web app. I
after reading the data from the request as Stream i needed to convert it
I am trying to download a file I have uploaded to an image field
According to the docs any file type can now be uploaded to Google Docs,
Ok - I have a WCF Service which reads an excel file from a
When trying to store a file I get the following: TypeError: can't convert nil
I want to convert my uploaded video with ffmpeg, but I had few error.

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.