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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:45:15+00:00 2026-06-09T02:45:15+00:00

So, i am developing simple web application using Spring Framework. The application users can

  • 0

So, i am developing simple web application using Spring Framework.

The application users can upload images.

What is best practices for storing/loading images?

I found solution on some forum, where someone suggested to store files to user.dir directory.

Ok, i also do that.

When user upload image i store the image to user.dir directory.

Now, i have a question: how to load image from user.dir directory to page?

 <img src="path/to/dir/where/images/stored"/>
  • 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-09T02:45:16+00:00Added an answer on June 9, 2026 at 2:45 am

    Best practice is indeed to store such data outside the webapp’s tree to avoid issues on redeployment. Where exactly they get stored is more a matter of convention, user.dir can indeed be a reasonable choice.

    You can’t serve these files directly though, commonly it’s done by creating a servlet mapped to eg images/* that parse the request URL (eg <img src="approot/images/apic.jpg"/>) and based on that url if fetches and serves path/to/dir/where/images/stored/apic.jpg. As an added bonus that servlet gives you full control over what gets downloaded, when and by who, maybe you will need this kind of control later on in the application lifecycle.

    You can use getPathInfo to retrieve the part of the URL following the servlet name, set the correct MIME type for the output, and streamcopy the requested file to the servlet’s output.

    A publicly available, well explained example of such a servlet can be found on BalusC’s blog

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

Sidebar

Related Questions

I am using spring 3.0.2 for developing a simple web based application like twitter.
I'm developing a web application using a very simple (maybe not really MVC-compliant) MVC
I am developing a very simple web application in python using the bottle microframework
I have been developing a small application in Python using the Web.py framework that
I'm developing a simple web application where in I need to display number a
I am developing a simple web page to be viewed after an iphone application
I'm developing a simple web service using MS Visual Studio 2008, C# and .net
Now on my localhost I'm starting developing first simple web service using ruby 1.9.2
I've been developing a simple Spring MVC application as a reporting service. Locally, I've
I am developing a web application. I am using Eclipse as IDE. I 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.