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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:14:08+00:00 2026-06-07T12:14:08+00:00

After uploading a file it gets stored as a .tmp file in a temp

  • 0

After uploading a file it gets stored as a .tmp file in a temp directory.

How can one get the actual file type of the file that was uploaded? I need to know if it’s a bmp, jpeg, png, etc. from server side.

Note: I’m also using Struts 2 version 2.1.8.1

  • 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-07T12:14:11+00:00Added an answer on June 7, 2026 at 12:14 pm

    On JSP if you have

    <s:form action="fileUpload" method="post" enctype="multipart/form-data" >
    
      <s:file name="userFile" label="File" />
    
      <s:submit />
    
    </s:form>
    

    in your ActionClass you need to add

    public void setUserFileContentType(String userImageContentType) {
        this.userImageContentType = userImageContentType;
    }
    public void setUserFileFileName(String userImageFileName) {
        this.userImageFileName = userImageFileName;
    }
    

    and then you would have access to the fileName and contentType of uploaded file

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

Sidebar

Related Questions

At the moment, after uploading a file, the tmp file that gets created gets
Using Struts 2: when will the .tmp file - that gets created after uploading
After uploading a file from the UI, how to create the a new directory
Full edit: The scenario is that after uploading the file to the server via
Getting ERR_CONNECTION_RESET after more or less 2 minutes of uploading a rather big file
I'm trying to make a script that automatically starts uploading after the data has
Here's the class I am working on. After uploading a file using a form,
Imagine I did upload a 50mb file to S3. After uploading it completely, the
I am uploading a image file to the server. Now after uploading the file
After uploading an image file (with Greek filename) on my website the image was

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.